Program 01

Embed Size (px)

Citation preview

  • 8/9/2019 Program 01

    1/2

    CS 201Spring 2015Program 1

    This assignment asks you to write a C++ program using selection, iteration, and functions

    The program will gather information a!out customers at a car rental company and determine how muchto !ill each customer The program will repeatedly prompt the user for the following items for eachcustomer "asking in this order#$

    The customer%s classification code "a character# The num!er of days the &ehicle was rented "an integer#

    The &ehicle%s odometer reading at the start of the rental period "a dou!le#

    The &ehicle%s odometer reading at the end of the rental period "a dou!le#'t will then process that customer information and display the results 't will halt when the user enters()* "or (*# instead of a classification code

    The program will compute the amount of money that he customer will !e !illed, !ased on the

    customer%s classification code, num!er of days in the rental period, and num!er of miles dri&enClassification codes may !e entered in upper or lower case

    Code %% "!udget#$ -.000 per day, plus -025 for each mile dri&enCode %/% "daily#$ -000 per day o mileage charge if dri&en 10 miles or less, otherwise -025 for eachmile dri&en a!o&e the 10 miday limitCode %3% "weekly#$ -14000 for each week or fraction of a week o mileage charge if the miles dri&enis 40 miles per week or less -1000 per week if the a&erage num!er of miles dri&en per week e6ceeds40 miles !ut does not e6ceed 150 miles otherwise -2000 per week plus -025 for each mile dri&ena!o&e the 150 mile per week limit

    The program will compute the num!er of miles dri&en !ased on the odometer readings The odometerhas si6 digits and records tenths of a mile

    7or each customer, the program will display the following summary$

    The customer%s classification code

    The num!er of days the &ehicle was rented

    The &ehicle%s odometer reading at the start of the rental period

    The &ehicle%s odometer reading at the end of the rental period

    The num!er of miles dri&en during the rental period

    The amount of money !illed to the customer for the rental period

    8ll output will !e appropriately la!eled and formatted 9onetary amounts will !e displayed with adollar sign

    The program will get the data for a customer, print the summary and amount !illed, and continue untila classification code of ()* or (* is entered

    :rror handling$The program will detect and reco&er from an in&alid classification code 'f an in&alid code is entered,the program will print an error message and prompt the user to re;enter the data The ending odometer

  • 8/9/2019 Program 01

    2/2

    reading must !e eual or greater than the starting odometer reading if this is not the case, the programwill prompt the user to re;enter the data The minimum possi!le rental is for 1 day the program shouldagain detect !ad data and prompt the user to re;enter the data

    Program structure$