I'm learning C++ here. I have a program I need completed. Here is the prompt:

profileglangsing
travel-expenses.cpp

// // travel-expenses.cpp // CECS 100 C++ projects // // Created by Shawn Jordison on 10/14/13. // Copyright (c) 2013 Shawn Jordison. All rights reserved. // #include <iostream> using namespace std; int getNumberOfDays() { int numberOfDays; cout << "How many days did you spend on the trip?\t"; cin >> numberOfDays; while (numberOfDays < 1) { cout << "You cannot spend less than 1 day on a trip." << endl; cout << "How many days did you spend on the trip?\t"; cin >> numberOfDays; } return numberOfDays; } int getTimeOfDeparture() { int timeOfDeparture; cout << "What time did you depart on the first day of the trip? (24h format)\t"; cin >> timeOfDeparture; while (timeOfDeparture < 0 || timeOfDeparture > 24) { cout << "Invalid time." << endl; cout << "What time did you depart on the first day of the trip? (24h format)\t"; cin >> timeOfDeparture; } return timeOfDeparture; } int getTimeOfArrival() { int timeOfArrival; cout << "What time did you arrive home on the last day of the trip? (24h format)\t"; cin >> timeOfArrival; while (timeOfArrival < 0 || timeOfArrival > 24) { cout << "Invalid time." << endl; cout << "What time did you arrive home on the last day of the trip? (24h format)\t"; cin >> timeOfArrival; } return timeOfArrival; } float getAmountRoundTripAirfare() { float amountRoundTripAirfare; cout << "Enter total cost of round trip airfare:\t"; cin >> amountRoundTripAirfare; while (amountRoundTripAirfare < 0) { cout << "You cannot spend less than $0." << endl; cout << "Enter total cost of round trip airfare:\t"; cin >> amountRoundTripAirfare; } return amountRoundTripAirfare; } float getAmountCarRentals() { float amountCarRentals; cout << "Enter the total cost of car rentals:\t"; cin >> amountCarRentals; while (amountCarRentals < 0) { cout << "You cannot spend less than $0." << endl; cout << "Enter the total cost of car rentals:\t"; cin >> amountCarRentals; } return amountCarRentals; } float getMilesDriven() // see if case/switch loop is more appropriate { float milesDriven; string answer; cout << "Did you use a private car at all? (Y/N)\t"; cin >> answer; while ((answer != "Y") && (answer != "y") && (answer != "N") && (answer != "n")) { cout << "Y for Yes, N for No.\t" << endl; cout << "Did you use a private car at all? (Y/N)\t"; cin >> answer; } if ( (answer == "Y") || (answer == "y") ) { cout << "Enter number of miles driven with private car:\t"; cin >> milesDriven; while (milesDriven < 0) { cout << "You cannot drive less than 0 miles." << endl; cout << "Enter number of miles driven with private car:\t"; cin >> milesDriven; } } else milesDriven = 0; return milesDriven * 0.27; } void getAmountParkingFees(float numberOfDays, float totalParkingFees, float allowedParkingFees, float& amountParkingFees, float& excessParkingFees) // function good { allowedParkingFees = allowedParkingFees * numberOfDays; cout << "Enter cost of parking fees by day, below:" << endl; for (int count = 1; count <= numberOfDays ; count++) { cout << "Day " << count << ":\t"; cin >> amountParkingFees; if ((amountParkingFees > 0) && (amountParkingFees <= 6)) { totalParkingFees += amountParkingFees; excessParkingFees = 0; } else if (amountParkingFees > 6) { totalParkingFees += amountParkingFees; excessParkingFees = totalParkingFees - allowedParkingFees; } else { while (amountParkingFees < 0) { cout << "You cannot spend less than $0." << endl; cout << "Day " << count << ":\t"; cin >> amountParkingFees; } } } } void getAmountTaxiFees(float numberOfDays, float totalTaxiFees, float allowedTaxiFees, float& amountTaxiFees, float& excessTaxiFees) // function good { string answer; allowedTaxiFees = allowedTaxiFees * numberOfDays; cout << "Did you use a taxi at all? (Y/N)\t"; cin >> answer; while ((answer != "Y") && (answer != "y") && (answer != "N") && (answer != "n")) { cout << "Y for Yes, N for No.\t" << endl; cout << "Did you use a private car at all? (Y/N)\t"; cin >> answer; } if ( (answer == "Y") | (answer == "y") ) { cout << "Enter cost of taxi fees by day, below:" << endl; for (int count = 1; count <= numberOfDays ; count++) { cout << "Day " << count << ":\t"; cin >> amountTaxiFees; if ((amountTaxiFees > 0) && (amountTaxiFees <= 10)) { totalTaxiFees += amountTaxiFees; excessTaxiFees = 0; } else if (amountTaxiFees > 10) { totalTaxiFees += amountTaxiFees; excessTaxiFees = totalTaxiFees - allowedTaxiFees; } else if (amountTaxiFees < 0) { while (amountTaxiFees < 0) { cout << "You cannot spend less than $0." << endl; cout << "Day " << count << ":\t"; cin >> amountTaxiFees; } } // else // figure out input invalidation for `for loop` // { // while (!isdigit(amountTaxiFees)) // { // cout << "Invalid entry." << endl; // cout << "Day " << count << ":\t"; // cin >> amountTaxiFees; // } // } } } else { amountTaxiFees = 0; excessTaxiFees = 0; totalTaxiFees = 0; } } float getAmountRegistrationFees() { float amountRegistrationFees; cout << "Enter the total cost of conference or seminar registration fees:\t"; cin >> amountRegistrationFees; while (amountRegistrationFees < 0) { cout << "You cannot spend less than $0." << endl; cout << "Enter the total cost of conference or seminar registration fees:\t"; cin >> amountRegistrationFees; } return amountRegistrationFees; } void getAmountHotelExpenses(float allowedHotelExpenses, float& amountHotelExpenses, float& totalHotelExpenses, float& excessHotelExpenses) // function good { float nightsSpentInHotel; cout << "Enter total nights spent in hotel:\t"; cin >> nightsSpentInHotel; while (nightsSpentInHotel < 1) { cout << "You cannot spend less than 1 night in a hotel." << endl; cout << "Enter total nights spent in hotel:\t"; cin >> nightsSpentInHotel; } allowedHotelExpenses = allowedHotelExpenses * nightsSpentInHotel; cout << "Enter cost of lodging fees by day, below:" << endl; for (int count = 1; count <= nightsSpentInHotel ; count++) { cout << "Night " << count << ":\t"; cin >> amountHotelExpenses; if ((amountHotelExpenses > 0) && (amountHotelExpenses <= 90)) { totalHotelExpenses += amountHotelExpenses; excessHotelExpenses = 0; } else if ( amountHotelExpenses > 90) { totalHotelExpenses += amountHotelExpenses; excessHotelExpenses = totalHotelExpenses - allowedHotelExpenses; } else { while (amountHotelExpenses < 0) { cout << "Invalid entry." << endl; cout << "Night " << count << ":\t"; cin >> amountHotelExpenses; } } } } void getAmountDepartureMealPrices(float timeOfDeparture, float& amountDepartureBreakfast, float& amountDepartureLunch, float& amountDepartureDinner, float& totalDepartureBreakfastExpenses, float& totalDepartureLunchExpenses, float& totalDepartureDinnerExpenses, float allowedBreakfastExpenses, float allowedLunchExpenses, float allowedDinnerExpenses, float& excessDepartureBreakfastExpenses, float& excessDepartureLunchExpenses, float& excessDepartureDinnerExpenses) // function good { if ( (timeOfDeparture > 0) && (timeOfDeparture < 7) ) { cout << "How much did breakfast cost on the day of departure?\t"; cin >> amountDepartureBreakfast; if ((amountDepartureBreakfast > 0) && (amountDepartureBreakfast < 9)) { totalDepartureBreakfastExpenses = amountDepartureBreakfast; excessDepartureBreakfastExpenses = 0; } else if ( amountDepartureBreakfast >= 9) { totalDepartureBreakfastExpenses = amountDepartureBreakfast; excessDepartureBreakfastExpenses = totalDepartureBreakfastExpenses - allowedBreakfastExpenses; } else { totalDepartureBreakfastExpenses = 0; excessDepartureBreakfastExpenses = 0; while (amountDepartureBreakfast < 0) { cout << "Invalid entry." << endl; cout << "How much did breakfast cost on the day of departure?\t"; cin >> amountDepartureBreakfast; } } amountDepartureLunch = 0; amountDepartureDinner = 0; totalDepartureLunchExpenses = 0; totalDepartureDinnerExpenses = 0; excessDepartureLunchExpenses = 0; excessDepartureDinnerExpenses = 0; } else if ( (timeOfDeparture > 7) && (timeOfDeparture < 12) ) { cout << "How much did lunch cost on the day of departure?\t"; cin >> amountDepartureLunch; if ((amountDepartureLunch > 0) && (amountDepartureLunch < 12)) { totalDepartureLunchExpenses = amountDepartureLunch; excessDepartureLunchExpenses = 0; } else if ( amountDepartureLunch >= 12) { totalDepartureLunchExpenses = amountDepartureLunch; excessDepartureLunchExpenses = totalDepartureLunchExpenses - allowedLunchExpenses; } else { totalDepartureLunchExpenses = 0; excessDepartureLunchExpenses = 0; while (amountDepartureLunch < 0) { cout << "Invalid entry." << endl; cout << "How much did lunch cost on the day of departure?\t"; cin >> amountDepartureLunch; } } amountDepartureBreakfast = 0; amountDepartureDinner = 0; totalDepartureBreakfastExpenses = 0; totalDepartureDinnerExpenses = 0; excessDepartureBreakfastExpenses = 0; excessDepartureDinnerExpenses = 0; } else if ( (timeOfDeparture > 12) && (timeOfDeparture < 18) ) { cout << "How much did dinner cost on the day of departure?\t"; cin >> amountDepartureDinner; if ((amountDepartureDinner > 0) && (amountDepartureDinner < 16)) { totalDepartureDinnerExpenses = amountDepartureDinner; excessDepartureDinnerExpenses = 0; } else if ( amountDepartureDinner >= 16) { totalDepartureDinnerExpenses = amountDepartureDinner; excessDepartureDinnerExpenses = totalDepartureDinnerExpenses - allowedDinnerExpenses; } else { totalDepartureDinnerExpenses = 0; excessDepartureDinnerExpenses = 0; while (amountDepartureDinner < 0) { cout << "Invalid entry." << endl; cout << "How much did dinner cost on the day of departure?\t"; cin >> amountDepartureDinner; } } amountDepartureBreakfast = 0; amountDepartureLunch = 0; totalDepartureBreakfastExpenses = 0; totalDepartureLunchExpenses = 0; excessDepartureBreakfastExpenses = 0; excessDepartureLunchExpenses = 0; } else { amountDepartureBreakfast = 0; amountDepartureLunch = 0; amountDepartureDinner = 0; totalDepartureBreakfastExpenses = 0; totalDepartureLunchExpenses = 0; totalDepartureDinnerExpenses = 0; excessDepartureBreakfastExpenses = 0; excessDepartureLunchExpenses = 0; excessDepartureDinnerExpenses = 0; } } void getAmountArrivalMealPrices(float timeOfArrival, float& amountArrivalBreakfast, float& amountArrivalLunch, float& totalArrivalBreakfastExpenses, float& totalArrivalLunchExpenses, float& allowedBreakfastExpenses, float& allowedLunchExpenses, float& excessArrivalBreakfastExpenses, float& excessArrivalLunchExpenses) // function good { if ( (timeOfArrival > 8) && (timeOfArrival < 19) ) { cout << "How much did breakfast cost on the day of arrival?\t"; cin >> amountArrivalBreakfast; if ((amountArrivalBreakfast > 0) && (amountArrivalBreakfast < 9)) { totalArrivalBreakfastExpenses = amountArrivalBreakfast; excessArrivalBreakfastExpenses = 0; } else if ( amountArrivalBreakfast >= 9) { totalArrivalBreakfastExpenses = amountArrivalBreakfast; excessArrivalBreakfastExpenses = totalArrivalBreakfastExpenses - allowedBreakfastExpenses; } else { totalArrivalBreakfastExpenses = 0; excessArrivalBreakfastExpenses = 0; while (amountArrivalBreakfast < 0) { cout << "Invalid entry." << endl; cout << "How much did breakfast cost on the day of arrival?\t"; cin >> amountArrivalBreakfast; } } amountArrivalLunch = 0; totalArrivalLunchExpenses = 0; excessArrivalLunchExpenses = 0; } else if ( (timeOfArrival >= 19) && (timeOfArrival <= 23) ) { cout << "How much did lunch cost on the day of arrival?\t"; cin >> amountArrivalLunch; if ((amountArrivalLunch > 0) && (amountArrivalLunch < 12)) { totalArrivalLunchExpenses = amountArrivalLunch; excessArrivalLunchExpenses = 0; } else if (amountArrivalLunch >= 12) { totalArrivalLunchExpenses = amountArrivalLunch; excessArrivalLunchExpenses = totalArrivalLunchExpenses - allowedLunchExpenses; } else { totalArrivalLunchExpenses = 0; excessArrivalLunchExpenses = 0; while (amountArrivalLunch < 0) { cout << "Invalid entry." << endl; cout << "How much did lunch cost on the day of arrival?\t"; cin >> amountArrivalLunch; } } amountArrivalBreakfast = 0; totalArrivalBreakfastExpenses = 0; excessArrivalBreakfastExpenses = 0; } else { amountArrivalBreakfast = 0; amountArrivalLunch = 0; totalArrivalBreakfastExpenses = 0; totalArrivalLunchExpenses = 0; excessArrivalBreakfastExpenses = 0; excessArrivalLunchExpenses = 0; } } float calculateTotalExpenses(float totalAmountRoundTripAirfare, float totalAmountCarRentals, float totalAmountCostMilesDriven, float totalParkingFees, float totalTaxiFees, float totalAmountRegistrationFees, float totalHotelExpenses, float totalDepartureBreakfastExpenses, float totalDepartureLunchExpenses, float totalDepartureDinnerExpenses, float totalArrivalBreakfastExpenses, float totalArrivalLunchExpenses) { return totalAmountRoundTripAirfare + totalAmountCarRentals + totalAmountCostMilesDriven + totalParkingFees + totalTaxiFees + totalAmountRegistrationFees + totalHotelExpenses + totalDepartureBreakfastExpenses + totalDepartureLunchExpenses + totalDepartureDinnerExpenses + totalArrivalBreakfastExpenses + totalArrivalLunchExpenses; } float calculateExcessExpenses(float excessParkingFees, float excessHotelExpenses, float excessDepartureBreakfastExpenses, float excessDepartureLunchExpenses, float excessDepartureDinnerExpenses, float excessArrivalBreakfastExpenses, float excessArrivalLunchExpenses) { return excessParkingFees + excessHotelExpenses + excessDepartureBreakfastExpenses + excessDepartureLunchExpenses + excessDepartureDinnerExpenses + excessArrivalBreakfastExpenses + excessArrivalLunchExpenses; } void displayOutput(float totalTotalExpenses, float totalExcessExpenses) { float overallExpenses = totalTotalExpenses + totalExcessExpenses; cout << endl << "Overall expenses: $" << overallExpenses; cout << endl << "Total covered expenses: $" << totalTotalExpenses; cout << endl << "Total excess expenses: $" << totalExcessExpenses; cout << endl; } int main() { float timeOfDeparture, timeOfArrival, numberOfDays, totalAmountRoundTripAirfare, totalAmountCarRentals, amountParkingFees, excessParkingFees, totalAmountCostMilesDriven, amountTaxiFees, excessTaxiFees, totalAmountRegistrationFees, amountHotelExpenses, totalHotelExpenses, excessHotelExpenses, amountDepartureBreakfast, amountDepartureLunch, amountDepartureDinner, totalDepartureBreakfastExpenses, totalDepartureLunchExpenses, totalDepartureDinnerExpenses, excessDepartureBreakfastExpenses, excessDepartureLunchExpenses, excessDepartureDinnerExpenses, amountArrivalBreakfast, amountArrivalLunch, totalArrivalBreakfastExpenses, totalArrivalLunchExpenses, excessArrivalBreakfastExpenses, excessArrivalLunchExpenses, totalTotalExpenses, totalExcessExpenses; float totalParkingFees = 0, totalTaxiFees = 0, allowedParkingFees = 6, allowedTaxiFees = 10, allowedHotelExpenses = 90; numberOfDays = getNumberOfDays(); timeOfDeparture = getTimeOfDeparture(); timeOfArrival = getTimeOfArrival(); float allowedBreakfastExpenses = 9, allowedLunchExpenses = 12, allowedDinnerExpenses = 16; getAmountDepartureMealPrices(timeOfDeparture, amountDepartureBreakfast, amountDepartureLunch, amountDepartureDinner, totalDepartureBreakfastExpenses, totalDepartureLunchExpenses, totalDepartureDinnerExpenses, allowedBreakfastExpenses, allowedLunchExpenses, allowedDinnerExpenses, excessDepartureBreakfastExpenses, excessDepartureLunchExpenses, excessDepartureDinnerExpenses); getAmountArrivalMealPrices(timeOfArrival, amountArrivalBreakfast, amountArrivalLunch, totalArrivalBreakfastExpenses, totalArrivalLunchExpenses, allowedBreakfastExpenses, allowedLunchExpenses, excessArrivalBreakfastExpenses, excessArrivalLunchExpenses); totalAmountRoundTripAirfare = getAmountRoundTripAirfare(); totalAmountRegistrationFees = getAmountRegistrationFees(); getAmountHotelExpenses(allowedHotelExpenses, amountHotelExpenses, totalHotelExpenses, excessHotelExpenses); totalAmountCarRentals = getAmountCarRentals(); totalAmountCostMilesDriven = getMilesDriven(); getAmountParkingFees(numberOfDays, totalParkingFees, allowedParkingFees, amountParkingFees, excessParkingFees); getAmountTaxiFees(numberOfDays, totalTaxiFees, allowedTaxiFees, amountTaxiFees, excessTaxiFees); totalTotalExpenses = calculateTotalExpenses(totalAmountRoundTripAirfare, totalAmountCarRentals, totalAmountCostMilesDriven, totalParkingFees, totalTaxiFees, totalAmountRegistrationFees, totalHotelExpenses, totalDepartureBreakfastExpenses, totalDepartureLunchExpenses, totalDepartureDinnerExpenses, totalArrivalBreakfastExpenses, totalArrivalLunchExpenses); totalExcessExpenses = calculateExcessExpenses(excessParkingFees, excessHotelExpenses, excessDepartureBreakfastExpenses, excessDepartureLunchExpenses, excessDepartureDinnerExpenses, excessArrivalBreakfastExpenses, excessArrivalLunchExpenses); displayOutput(totalTotalExpenses, totalExcessExpenses); return 0; }