Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 399 Weeks Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 15 Sep 2017 My Price 10.00

car rental company

NOTE: Remember that you areNOTallowed to use thebreak, return,orexitstatements toexit from a loop. All loops must exitONLYvia theirtest 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 acompact,mid size,full size,orSUVcar 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 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 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 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 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 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.

Answers

(5)
Status NEW Posted 15 Sep 2017 10:09 PM My Price 10.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)