[Solved]Need Flow Chart Algorithm Code Please Include Using Namespace Std Get Days Int Noofdays In Q37078058
I need a flow chart and algorithm for this code please.
#include <iostream>
using namespace std;
//get no of days
int noOfDays()
{
int days;
cout<<“nEnter the number of days spent: “;
cin>>days;
if(days<1){
cout<<“nInvalid input “;
noOfDays();
}
return days;
}
//get departure time
float timeOfDept()
{
float time;
cout<<“nEnter the time of departure in 24 hours format:”;
cin>>time;
if(!(time>=0.0 && time<25.00)){
cout<<“nInvalid input “;
timeOfDept();
}
return time;
}
//get arrival time
float timeOfArrival()
{
float time;
cout<<“nEnter the time of arrival in 24 hours format:”;
cin>>time;
if(!(time>=0.0 && time<25.00)){
cout<<“nInvalid input “;
timeOfArrival();
}
return time;
}
//get the air fare
double airfare()
{
double fare;
cout<<“nEnter the round trip airfare: “;
cin>>fare;
if(!(fare>0.0) ){
cout<<“nInvalid input “;
airfare();
}
return fare;
}
//get the car rent , if own vehicle get the miles driven
double carRent()
{
double rent, miles;
cout<<“nEnter the amount of car rent, if private vehicleused enter 0: “;
cin>>rent;
if(rent<0) {
cout<<“nInvalid input “;
carRent();
}
if(rent==0){
cout<<“nEnter the miles driven: “;
cin>>miles;
if(miles<1) {
cout<<“nInvalid input “;
carRent();
}
rent=miles * 0.27;
}
return rent;
}
//get the parking fee
double parkingFee(int days)
{
double fee;
cout<<“nEnter the parking fee: “;
cin>>fee;
if(fee<1) {
cout<<“nInvalid input “;
parkingFee(days);
}
return fee-(6*days);
}
//get the taxi fee
double taxiFee(int days)
{
double fee;
cout<<“nEnter the taxi fee: “;
cin>>fee;
if(fee<1) {
cout<<“nInvalid input “;
taxiFee(days);
}
return fee-(days*10);
}
//get the registration fee
double regFee()
{
double fee;
cout<<“nEnter the registration fee: “;
cin>>fee;
if(fee<1) {
cout<<“nInvalid input “;
regFee();
}
return fee;
}
//get the hotel expenses
double hotelExpense(int days)
{
double fee;
cout<<“nEnter the hotel expense: “;
cin>>fee;
if(fee<1) {
cout<<“nInvalid input “;
hotelExpense(days);
}
return fee-(days*90);
}
//get the allowable meal cost
double mealCost(int days,float arr, float dept)
{
double cost;
cout<<“nEnter the amount od allowable meals: “;
cin>>cost;
if(cost<1) {
cout<<“nInvalid input “;
mealCost(days,arr,dept);
}
if(dept<=7)
cost-=9;
else if (dept>7 && dept<=12)
cost-=12;
else if(dept>12 && dept<=18)
cost-=16;
if(arr<=8)
cost-=9;
else if(arr>8 &&arr<=13)
cost-=12;
else if(arr>13 &&arr<=19)
cost-=16;
cost-=(days*(9+12+16));
return cost;
}
//main function
int main()
{
cout << “Enter the details” << endl;
//variable declaration
int days;
float arr,dept;
double air,rent,taxi,park,reg,hotel,meal,total;
//call the function and get the values
days=noOfDays();
dept=timeOfDept();;
arr=timeOfArrival();
air=airfare();
rent=carRent();
taxi=taxiFee(days);
park=parkingFee(days);
reg=regFee();
hotel=hotelExpense(days);
meal=mealCost(days,arr,dept);
//calculate the total cost
total=air+rent+taxi+park+reg+hotel+meal;
//print the cost
cout<<“nTotal expenses: $”<<total<<“n”;
return 0;
}
Expert Answer
Answer to I need a flow chart and algorithm for this code please. #include using namespace std; //get no of days int noOfDays() { … . . .
OR

