STARTING OUT WITH C++ REVEL >IA<
STARTING OUT WITH C++ REVEL >IA<
9th Edition
ISBN: 9780135853115
Author: GADDIS
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 6, Problem 25PC

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.

Blurred answer
Students have asked these similar questions
A design technique that helps to reduce the duplication of code within a program and is a benefit of using functions is __________.a. code reuseb. divide and conquerc. debuggingd. facilitation of teamwork
1. Briefly describe the items a programmer needs to know when using a predefined function, including the header file name, the function name, the parameter type, and the return type. 2. Define the terms function header (or heading), function body, and function definition. Describe the elements of a function. 3. Define the terms actual parameter and formal parameter and explain the difference between the two. 4. Describe in detail the flow of execution in a program with functions. Review the use of function prototypes to facilitate compilation. Also, explain how a function call operates during program execution. 5. Discuss how a function call operates in terms of how the values in the actual parameters are transferred to the formal parameters.
Function #2: largest Parameters: num1 - a floating point number being compared against num2 and num3 num2 - a floating point number being compared against num1 and num3 num3 - a floating point number being compared against num1 and num2 Description: Write a function that takes in three numbers as parameters and prints out the largest of the three. If two or all of the numbers are equal, or even all three, then just print the value once. Test Cases: >>>largest(433.1, 2340.32, 12323.7) 12323.7 >>>largest(12.0, 32.1, 32.1) 32.1 >>>largest(23.44, 23.44, 23.44) 23.44

Chapter 6 Solutions

STARTING OUT WITH C++ REVEL >IA<

Ch. 6.9 - How many return values may a function have?Ch. 6.9 - Write a header for a function named distance. The...Ch. 6.9 - Write a header for a function named days. The...Ch. 6.9 - Write a header for a function named getKey. The...Ch. 6.9 - Write a header for a function named lightYears....Ch. 6.11 - What is the difference between a static local...Ch. 6.11 - Prob. 6.17CPCh. 6.11 - Prob. 6.18CPCh. 6.13 - Prob. 6.19CPCh. 6.13 - Write the prototype and header for a function...Ch. 6.13 - Write the prototype and header for a function...Ch. 6.13 - What is the output of the following program?...Ch. 6.13 - The following program asks the user to enter two...Ch. 6.15 - What is the output of the following program?...Ch. 6.15 - What is the output of the following program?...Ch. 6 - Why do local variables lose their values between...Ch. 6 - What is the difference between an argument and a...Ch. 6 - Where do you define parameter variables?Ch. 6 - If you are writing a function that accepts an...Ch. 6 - When a function accepts multiple arguments, does...Ch. 6 - How do you return a value from a function?Ch. 6 - What is the advantage of breaking your...Ch. 6 - How would a static local variable be useful?Ch. 6 - Give an example where passing an argument by...Ch. 6 - The_______ is the part of a function definition...Ch. 6 - If a function doesnt return a value, the word...Ch. 6 - Either a functions _______ or its _______ must...Ch. 6 - Values that are sent into a function are called...Ch. 6 - Special variables that hold copies of function...Ch. 6 - When only a copy of an argument is passed to a...Ch. 6 - A(n) _______ eliminates the need to place a...Ch. 6 - A(n) _______ variable is defined inside a function...Ch. 6 - _______ variables are defined outside all...Ch. 6 - _______ variables provide an easy way to share...Ch. 6 - Unless you explicitly initialize global variables,...Ch. 6 - If a function has a local variable with the same...Ch. 6 - _______ local variables retain their value between...Ch. 6 - The _______ statement causes a function to end...Ch. 6 - _______ arguments are passed to parameters...Ch. 6 - When a function uses a mixture of parameters with...Ch. 6 - Prob. 26RQECh. 6 - When used as parameters, _______ variables allow a...Ch. 6 - Reference variables are defined like regular...Ch. 6 - Reference variables allow arguments to be passed...Ch. 6 - The _______ function causes a program to...Ch. 6 - Two or more functions may have the same name, as...Ch. 6 - Examine the following function header, then write...Ch. 6 - The following statement calls a function named...Ch. 6 - A program contains the following function: int...Ch. 6 - Write a function named timesTen that accepts an...Ch. 6 - A program contains the following function: void...Ch. 6 - Write a function named getNumber that uses a...Ch. 6 - T F Functions should be given names that reflect...Ch. 6 - Prob. 39RQECh. 6 - T F Function prototypes are terminated with a...Ch. 6 - T F If other functions are defined before main,...Ch. 6 - T F When a function terminates, it always branches...Ch. 6 - T F Arguments are passed to the function...Ch. 6 - T F The scope of a parameter is limited to the...Ch. 6 - T F Changes to a function parameter always affect...Ch. 6 - T F In a function prototype, the names of the...Ch. 6 - T F Many functions may have local variables with...Ch. 6 - T F Overuse of global variables can lead to...Ch. 6 - T F Static local variables are not destroyed when...Ch. 6 - T F All static local variables are initialized to...Ch. 6 - T F Initialization of static local variables only...Ch. 6 - T F When a function with default arguments is...Ch. 6 - T F It is not possible for a function to have some...Ch. 6 - T F The exit function can only be called from...Ch. 6 - T F A stub is a dummy function that is called...Ch. 6 - Each of the following functions has errors. Locate...Ch. 6 - double average(int value1, int value2, int value3)...Ch. 6 - void area(int length =30, int width) { return...Ch. 6 - void getValue(int value) { cout "Enter a value:...Ch. 6 - (Overloaded functions) int getValue() { int...Ch. 6 - Markup Write a program that asks the user to enter...Ch. 6 - Rectangle AreaComplete the Program If you have...Ch. 6 - Winning Division Write a program that determines...Ch. 6 - Safest Driving Area Write a program that...Ch. 6 - Falling Distance When an object is falling because...Ch. 6 - Kinetic Energy In physics, an object that is in...Ch. 6 - Celsius Temperature Table The formula for...Ch. 6 - Coin Toss Write a function named coinToss that...Ch. 6 - Present Value Suppose you want to deposit a...Ch. 6 - Future Value Suppose you have a certain amount of...Ch. 6 - Lowest Score Drop Write a program that calculates...Ch. 6 - Star Search A particular talent competition has...Ch. 6 - Days Out Write a program that calculates the...Ch. 6 - Order Status The Middletown Wholesale Copper Wire...Ch. 6 - Overloaded Hospital Write a program that computes...Ch. 6 - Population In a population, the birth rate is the...Ch. 6 - Transient Population Modify Programming Challenge...Ch. 6 - Paint Job Estimator A painting company has...Ch. 6 - Prob. 19PCCh. 6 - Stock Profit The profit from the sale of a stock...Ch. 6 - Multiple Stock Sales Use the function that you...Ch. 6 - isPrime Function A prime number is a number that...Ch. 6 - Prob. 23PCCh. 6 - Rock, Paper, Scissors Game Write a program that...Ch. 6 - Group Project 25. Travel Expenses This program...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
.2: Function Parameters and Arguments - p5.js Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=zkc417YapfE;License: Standard Youtube License