#include <iostream>
#include <iomanip>
using namespace std;
//Function prototypes
int getDays();
double getDepartureTime();
double getArrivalTime();
double getAirfareFees();
double getRentalFees();
int getMileageFees();
double getParkingFees(int days);
double getTaxiFees(int days);
double getRegistrationFees();
double getHotelExpenses(int days);
double getBreakfastExpenses(int days, double dTime, double aTime);
double getLunchExpenses(int days, double dTime, double aTime);
double getDinnerExpenses(int days, double dTime, double aTime);
//Global constants
const double MILES = 0.27; //Expense per miles driven
const int PARKING = 6; //Allowed daily parking allowance
const int TAXI = 10; //Allowed daily taxi allowance
const int HOTEL = 90; //Allowed nightly hotel allowance
const int BKFST = 9; //Allowed daily breakfast allowance
const int LUNCH = 12; //Allowed daily lunch allowance
const int DINNER = 16; // ALlowed daily dinner allowance
int main()
{
//Variable Declaration
double grandTotal = 0, //Total expenses incurred
allowedTotal = 0, //Total allowable expenses for the trip
reimburseTotal = 0, //Excess that must be reimbursed, if any
savedTotal = 0, //Amount saved, if any
mealExpenses; //Total cost incurred for meals
//Input & function processing
//Bullet 1
int days = getDays();
{
int getDays();
}
{
int days;
cout << "Enter total of days you'll be staying: ";
cin >> days;
if (days < 0)
cout << "Days cannot be less than 0 \n\n"
<< "Enter total of days you'll be staying again: \n";
cin >> days;
}
//Bullet 2
double dTime = getDepartureTime();
{
double getDepartureTime();
}
{
cout << "Enter your departure time: ";
cin >> dTime;
if (dTime < 0)
{
cout << "Time cannot be less than 0 \n"
<< "Enter departure time again: \n";
cin >> dTime;
}
else if (dTime > 24)
{
cout << "Time cannot exceed more than 24 hours \n"
<< "Enter departure time again: \n";
cin >> dTime;
}
}
This code going to be divided into separate functions and from the looks of it i might be messing up. The code that i have should be in a seperate function outside of int main but i'm not sure if doing this correctly cause i'm new to this function stuff and the book i have is showing bad examples of how to structure this function.