Using Files—Travel Expenses This program should be designed and written by a tea
ID: 3763747 • Letter: U
Question
Using Files—Travel Expenses
This program should be designed and written by a team of students. Here are some suggestions:
One student should design function main, which will call the other functions in the program. The rest of the functions should be designed by other team members.
Analyzetheprogramrequirementssoeachstudentisgivenaboutthesameworkload.
Decide on the function names, parameters, and return types in advance.
Use stubs and drivers to test and debug the program.
The program can be implemented either as a multi-file program, or all the functions
can be cut and pasted into the main file.
Here is the assignment. Write a program that calculates and displays the total travel expenses of a businessperson on a trip. The program should have functions that ask for and return the following:
Thetotalnumberofdaysspentonthetrip
Thetimeofdepartureonthefirstdayofthetrip,andthetimeofarrivalbackhome
on the last day of the trip
The amount of any round-trip airfare
The amount of any car rentals
Miles driven, if a private vehicle was used. Vehicle allowance is $0.58 per mile.
Parking fees. (The company allows up to $12 per day. Anything in excess of this
must be paid by the employee.)
Taxi fees. (The company allows up to $40 per day for each day a taxi was used.
Anything in excess of this must be paid by the employee.)
Conference or seminar registration fees
Hotel expenses. (The company allows up to $90 per night for lodging. Anything in
excess of this must be paid by the employee.)
The cost of each meal eaten. On the first day of the trip, breakfast is allowed as an
expense if the time of departure is before 7 a.m. Lunch is allowed if the time of departure is before noon. Dinner is allowed if the time of departure is before 6 p.m. On the last day of the trip, breakfast is allowed if the time of arrival is after 8 a.m. Lunch is allowed if the time of arrival is after 1 p.m. Dinner is allowed if the time of
arrival is after 7 p.m. The program should only ask for the costs of allowable meals. (The company allows up to $18 for breakfast, $12 for lunch, and $20 for dinner. Anything in excess of this must be paid by the employee.)
Explanation / Answer
#include using namespace std; int totalDays; double departureTime; double arrivalTime; double airfareAmount; double carRental; double privateVehicle; double privateVehicleexpense; double parkingFee; double taxiFee; double conf_regFee; double hotelAmount; double totalExpense; double totalAllowexpense; int main() { int totalDaysin; double departureTimein; double arrivalTimein; double airfareAmountin; double carRentalin; double privateVehiclein; double parkingFeein; double taxiFeein; double conf_regFeein; double hotelAmountin; cout > totalDaysin; cout > departureTimein; cout > arrivalTimein; cout > airfareAmountin; cout > carRentalin; cout > privateVehiclein; cout > parkingFeein; cout > taxiFeein; cout > conf_regFeein; cout > hotelAmountin; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.