Details of this Paper

car rental company




NOTE: Remember that you are NOT allowed to use the break, return, or exit statements to exit from a loop. All loops must exit ONLY via their test condition.;Program #1;The car rental company would like you to write a program to calculate and print their car;rental bills. You will also write a test plan to test the program.;This rental car company has four sizes of cars. The customers can rent a compact, mid size, full size, or SUV car at the following rates;Car CarCharge Daily Rate;Size (1-6 days);Compact $ 22.91;Mid size $25.76;Full size $ 28.87;SUV $ 98.88;Cars rented for 7 or more days are charged a lower weekly rate for whole weeks. The discountis applied to the daily rate.;Car Charge Weekly Rate (for 7 days): 6.5 x Daily Rate;Rate Examples: 12 days = 1 x weekly rate + 5 x daily rate;14 days = 2 x weekly rate;15 days = 2 x weekly rate + 1 x daily rate;Some mileage is included, but customers must pay for any mileage over the allowance;Car Mileage Cost per;Size Included (per day) Mile for Overage;Compact 20 miles 5 cents;Mid size 25 miles 7 cents;Full size 30 miles 9 cents;SUV unlimited none;All car rentals are also subject to a 11.5% tax on the full charge, including mileage.;Implementation Details;Define constants for all fixed values and use double precision floating point variables for alldollar& cents figures.;First explain what the program will do.;Then call a user-defined function to read and validate the car size. Display a menu of car sizes,along with daily costs of each, to the user. Prompt for the car size (C, M, F, or S), and errorcheck that the user has entered a valid choice (accepted in upper or lowercase). Re-prompt untila valid choice is entered. Return the validated choice in uppercase.;Next call a user-defined function to read and validate the number of days rented, as describedbelow. Days rented will be whole numbers, and will be at least 1.;If necessary (for all car sizes, except SUV), call the same user-defined function again, to readand validate the miles driven. Miles driven will be whole numbers, and will be at least 1.;Call a user-defined function to calculate the bill components and the bill total. This functionwill call two other user-defined functions, as described below.;Display a couple of blank lines after all input has been entered and before the bill output isdisplayed. Call a user-defined function to display the output.;The output should first display a summary of the rental: the car size in words, the days rented,and the miles driven (unless SUV). Then the bill should be output, including lines for the totalcar charge, the mileage charge (unless 0), the tax, and the grand total.;After displaying the results, ask the user whether to execute the program again, and do so, aslong as the user wishes to continue. Be sure to error check the user?s answer is valid, and loopuntil a valid answer is entered (as part of implementing nested loops).;At a minimum, the program must implement the following functions (in addition to main);One function to read and validate the car size choice.;One generic function to read and validate that a number entered is 1 or more. Thisfunction should have a string parameter, identifying the value to be read (to be used inprompts and error messages). Loop and re-prompt until a valid value is entered.;One function to calculate the total car charge.;One function to calculate the mileage charge.;One function to calculate the bill amounts. This function should call the previous twofunctions, and should pass the car charge, the mileage charge, the tax and the grandtotal back to main via reference parameters.;One function to display the output.;Use of global variables is NOT allowed. The functions must use parameters to pass requireddata to each function.;Remember to pass all input only parameters by value, and pass all output parameters byreference.;Output parameters should only be used when more than one value is being passed backfrom main. For only one value, use the return statement.


Paper#70967 | Written in 18-Jul-2015

Price : $32