Question: Need to do on DEV C++ Program Here is the assignment. Write a program that calculates and displays the total travel expenses of a businessperson
Need to do on "DEV C++" Program
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 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 use. Vehicle allowance is $0.58 per mile.
- Parking fees. (The company allows $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 taxi was used. Anything in excess 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 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 the 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 $18 for breakfast, $12 for lunch, and $20 for dinner. Anything in excess must be paid by the employee. ) [After means greater than or equal to the specified time]
The program should perform 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 nicely formatted expense report that includes the amount spent and the amount allowed for the entire trip. The report can be displayed on the console output or in a file.
Input Validation: The program should not accept negative numbers for any dollar amount or for miles driven in a private vehicle. It should also ensure that the number of days is at least 1 and that the time of departure and the time of arrival are valid.
Sample Output:

Example output of *file (*Output can be part of the console):

Employee Expense report Employee name: Mr John Smith How many days were spent on the trip? 3 Enter the departure time (using 24-hour HH.MM format) -58 Departure time must be between e.e0 and 23.59. Please re-enter: 16.30 Enter the return time (using 24-hour HH.MM format): 13.00 Enter the amount of airfare: 500.00 Enter the amount spent for car rental: -58 This expense must be e or greater. Please re-enter: 58 Enter the number of miles driven by private vehicle: 60 Enter the amount of parking fees: 30 Enter the amount of taxi fees: 24.00 Enter the amount of conference registration: 250.00 Enter the nightly hotel rate: 110.00 Day 1: Enter the amount for dinner: 15.00 Day 2: Enter the amount for breakfast: 9.00 Enter the amount for lunch: 12.0e Enter the amount for dinner: 15.00 Day 3: Enter the amount for breakfast: 9.00 Enter the amount for lunch: 12.0e Employee Expense report Employee name: Mr John Smith How many days were spent on the trip? 3 Enter the departure time (using 24-hour HH.MM format) -58 Departure time must be between e.e0 and 23.59. Please re-enter: 16.30 Enter the return time (using 24-hour HH.MM format): 13.00 Enter the amount of airfare: 500.00 Enter the amount spent for car rental: -58 This expense must be e or greater. Please re-enter: 58 Enter the number of miles driven by private vehicle: 60 Enter the amount of parking fees: 30 Enter the amount of taxi fees: 24.00 Enter the amount of conference registration: 250.00 Enter the nightly hotel rate: 110.00 Day 1: Enter the amount for dinner: 15.00 Day 2: Enter the amount for breakfast: 9.00 Enter the amount for lunch: 12.0e Enter the amount for dinner: 15.00 Day 3: Enter the amount for breakfast: 9.00 Enter the amount for lunch: 12.0e
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
