One night you receive a call from your uncle who owns the APEX USED CAR COMPANY. He
Question:
One night you receive a call from your uncle who owns the APEX USED CAR COMPANY. He asks you to write a program that will modify a file containing information about the cars that your uncle is getting ready to sell this month from his used car lot. Your uncle wants your program to allow him to increase the price on some cars and decrease the price on other cars.
The data file that he wants modified is presented below:
|
The file contains the first and last names of the customers along with the quoted cost of the car, the day month and year of pickup, and the make of the car using the codes below:
F - FordL - LexusN - NissanM - MercedesH - HondaA - AudiC - ChryslerV - VolvoP - Porche
Requirements
1) Your program should follow the structure chart below:
Program Structure Chart2) You should define an enum type for the "CarMake" with values {Audi, Chrysler, Ford, ...}
3) You should define a struct named "Date" with data members day, month, and year
4) Your program must declare a user-defined struct named "Car". This type should have data members for the first and last name of the customer, the cost of the car, the date of delivery (using the Date struct) and a enum value using the CarMake enum type.
5) The main function should use an end-of-file loop to call the Get_car_data function and use an array for Car structs to store each of the Car structs that are returned.
6) The Get_car_data function reads one set of car data from the input file, stores the data in a local Car struct and returns this struct to main.
7) After the input file has been read, the main function should use a do while loop (with a sentinel value of "N") to prompt the user for the make of the car to modify. After the user enters the make of the car, the Lookup_Car_data function is called.
8) The Lookup_Car_data function should find the first car of this make in the Car array and display the car data to the user and prompt the user for the desired discount. Then this function should call the Modify_Car_data function with the discount percentage, the integer index of the selected car, and the Car array.
9) The Modify_Car_data function should apply the discount to the price data member of the Car struct in the Car array for the selected car as indicated by the Car index parameter.
10) In the main function, once the user enters "N" indicating that they are finished modifying car data, the Output_car_data function should be called with the output file and the Car array
11) The Output_car_data function should call the Print_Car_Report function with the Car array. Next, the Write_Car_Output is called with the output file and the Car array.
12) The Write_Car_output function loops through the data in the Car array and outputs the car data to lines of the output file.
13) The Print_Car_Report function prints a heading and then loops through the data in the Car array and displays the car data to lines of the console window.
Artificial Intelligence A Modern Approach
ISBN: 978-0137903955
2nd Edition
Authors: Stuart J. Russell and Peter Norvig