+1-316-444-1378

NOTE: Remember that you areNOTallowed to use thebreak returnorexitstatements toexit from a loop. All loops must exitONLYvia theirtest condition.Program #1The car rental company would like you to write a program to calculate and print their carrental 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 acompactmid sizefull sizeorSUVcar at the following rates:Car CarCharge Daily RateSize(1-6 days)Compact $ 22.91Mid size $25.76Full size $ 28.87SUV $ 98.88Cars 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 RateRate Examples: 12 days = 1 x weekly rate + 5 x daily rate14 days = 2 x weekly rate15 days = 2 x weekly rate + 1 x daily rateSome mileage is included but customers must pay for any mileage over the allowance:Car Mileage Cost perSize Included (per day) Mile for OverageCompact 20 miles 5 centsMid size 25 miles 7 centsFull size 30 miles 9 centsSUV unlimited noneAll car rentals are also subject to a 11.5% tax on the full charge including mileage.Implementation DetailsDefine constants for all fixed values and usedoubleprecision floating point variables for alldollar& cents figures.First explain what the program will do.Then call auser-definedfunction to read and validate the car size. Display a menu of car sizesalong 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 inuppercase.Next call auser-definedfunction 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 thesameuser-definedfunction again to readand validate the miles driven. Miles driven will be whole numbers and will be at least 1.Call auser-definedfunction to calculate the bill components and the bill total. This functionwill call two otheruser-definedfunctions as described below.Display a couple of blank linesafterall input has been entered andbeforethe bill output isdisplayed. Call auser-definedfunction to display the output.The output should first display a summary of the rental: the car size in words the days rentedand 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 aminimum the program must implement the following functions (in addition tomain): 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 tomainviareferenceparameters. One function to display the output.Use of global variables isNOTallowed. The functions must useparametersto pass requireddata to each function. Remember to pass allinputonly parametersby value and pass alloutputparametersbyreference.Output parameters shouldonlybe used whenmore than onevalue is being passed backfrom main. For onlyonevalue use thereturnstatement.

Categories: Uncategorized