Group Project
25. 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 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 workload.
• The 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 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:
• 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.27 per mile driven
• 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 12 noon. Dinner is allowed on the first day 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 on the last day 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 calculate and display the total expenses incurred by the businessperson, the total allowable expenses for the trip, the excess that must be reimbursed by the businessperson, if any, and the amount saved by the businessperson it the expenses were under the total allowed.
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.
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
- the code must be applicable in Dev C++arrow_forwardTracking laps Learning Objectives In this lab, you will practice writing functions, passing arguments and returning results from the function printing the result of a function call writing your code as a module Instructions Main Idea An Olympic-size swimming pool is used in the Olympic Games, where the racecourse is 50 meters (164.0 ft) in length. "In swimming, a lap is the same as a length. By definition, a lap means a complete trip around a race track, in swimming, the pool is the race track. Therefore if you swim from one end to the other, you’ve completed the track and thus you’ve completed one lap or one length." (Source: What Is A Lap In Swimming? Lap Vs Length) Write the function meters_to_laps() that takes a number of meters as an argument and returns the real number of laps. Complete the program to output the number of laps with two digits after the period. Examples Input: 150 Output : 3.00 Input: 80 Output: 1.60 Your program must define and call the following…arrow_forwardIf you have the time, it would be much appreciated if you could offer a more in-depth description of the function that metrics serve in the process of designing software. Everything has to have a description that is quite in-depth.arrow_forward
- When invoking a function that takes a significant number of arguments, the order in which those parameters are sent in is quite important.arrow_forwardWhen executing a function that accepts multiple arguments, the order in which parameters are supplied is crucial.arrow_forward:The parameters specified in the function heading are known as formal parameters value parameters actual parameters original parametersarrow_forward
- The scope of a function contains.. a. all variables defined within the function and the function parameters. b. all variables defined within the function but not the function parameters c. all variables in the program no matter where they are defined. d. only the function parametersarrow_forwardLocal declarations are those that are kept in the memory of the computer; but, how exactly are they kept in memory? If reaching one's objective can be done without making use of local declarations, then doing so is a waste of time. Why bother using value parameters when you can just use references as your arguments in any function? How crucial are value parameters when it comes to the processing of programmed data?arrow_forwardWhy is it vital to define functions while developing code?arrow_forward
- When calling a function that takes many arguments, it is necessary to determine whether or not the order in which parameters are supplied makes a difference.arrow_forwardParameters are the value passed to a function when the function is called and Argument are the variable defined in the function definition. True or falsearrow_forwardWhether or not the order in which parameters are specified when invoking a function that accepts multiple arguments is critical.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,