8
« on: April 12, 2009, 08:22:18 PM »
Group Project
12. 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 pro-gram. The remainder of the functions will be designed by other members of the team.
The requirements of the program should be analyzed so each student is given about the same work load.
The names, parameters, and return types of each function should be decided in advance.
Stubs and drivers should be used 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 business person on a trip. The program should have functions that ask for and return the following:
The total number of days spent on the trip
The time of departure on the first day of the trip, and the time of arrival back home 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. Calculate the vehicle expense as $0.38 per mile.
Parking fees (The company allows up to $6 per day. Anything in excess of this must be paid by the employee.)
Taxi fees, if a taxi was used anytime during the trip (The company allows up to $10 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 amount 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 amounts of allowable meals. (The company allows up to $9 for breakfast, $12 for lunch, and $16 for dinner. Anything in excess of this must be paid by the employee.)The program should perform the necessary calculations to determine the total amount spent by the business traveler in each category (mileage charges, parking, hotel, meals, etc.) as well as the maximum amount
allowed
in each category. It should then create a well laid out expense report that includes the amount spent and the amount allowed in each category, as well as the total amount spent and total amount allowed for the entire trip. This report should be written to a file.
Input Validation: Do not accept negative numbers for any dollar amount or for miles driven in a private vehicle. Do not accept numbers less than 1 for the number of days. Only accept valid times for the time of departure and the time of arrival.
ok that is my assignment, i have to take care of the food.
i am stumped on what to do, i have figured out the other stuff but my group decided to give me the work load on what to do for the food.
any pointers on how i can get the program to calculate the food