A rental car company rents 4 sizes of cars. The customers can rent a compact, mid-size, full size, or SUV.;The rental car company stores its cars in a parking garage, by car type.;The parking garage has 6 levels. The rental company has been allocated 4 rows on each level, one for each;type of car. Each row can hold up to 5 cars.;Data Structure Requirements;You will store data about the number of cars currently available for rental (i.e. parked in the parking garage);in a two-dimensional array. The array will be indexed by levels and by car sizes. The program will;implement an enumerated type to define all of the car sizes.;The program should use all defined indexes (i.e. do not skip array index 0). Each location in the array will;hold the number of cars parked in one row of one level (up to 5 cars per row on each level). Level 0 is;underground, and levels 1 ? 5 are above ground.;Data File Requirements;This week you will store your data in a binary file, instead of a text file, between program runs.;The binary file, GARAGE.BIN, will contain data on occupied rows only. This means that data on empty;rows (rows with 0 cars in them) will not be stored.;For each non-empty row (i.e. each row with cars in it), the following three pieces of data will be stored in;the file, in binary format;- the level index;- the row index;- the number of cars parked in the row;NOTE: Any level/row combination not stored in the data file will be assumed to be empty.;The first time you run the program, the GARAGE.BIN file will not exist. Then after you run the program;once, the program will create a GARAGE.BIN file, which you can use for subsequent runs.;Program Implementation Requirements;Write a modular program (minimum of SEVEN functions that have arguments or return values), to do;the following;1. Display a short explanation about what the program does to the user.;2. If the GARAGE.BIN file does not yet exist, the garage will start out completely full. Use nested;loops to initialize the two-dimensional array, representing the levels and rows in the parking;garage, to all full (i.e. assign the value 5 to all cells).;3. If the GARAGE.BIN file exists (on the second and subsequent runs), then it contains sets of data;about non-empty rows that need to be loaded into the array.;a. Use nested loops to initialize the two-dimensional array, representing the levels and rows in;the parking garage, to all empty (i.e. assign the value 0 to all cells).;b. Then use a loop to read the sets of data stored in the file, indicating how many cars are stored;in the non-empty levels and rows.;i. First read three data items (the level index, the row index, and the number of cars in that;level/row) from the file into temporary integer variables. Then use the level and row;index values that were read to index the 2D array, and store the number of cars for that;level and row into the array.;ii. Continue to read three data items at a time from the file, and use them to index the array;and store the number of cars in each non-empty level/row, until you reach the end of the;file.;HINT: All of the input file data will be read sequentially (no random access).;Be sure to read the three data values (the level index, the row index, and the number of;cars) in the same order that they were written to the file. A program's correct;interpretation of the binary data is dependent upon reading the data in the same order that;it was originally written.;iii. Close the file and display a message indicating that all the file data has been read.;NOTE: After you read the data from the file, you will not be using the file again while the;user runs the program to rent and turn in cars. All modifications will be made to the 2D;garage array. You will not access the file again until the user chooses to exit the program.;4. After reading the data from the binary file (if it existed) or starting from a full array;loop, letting the user mark cars as returned or rented, as follows;a. First use nested loops to display the garage status.;Within the loops, count and display the total number of available cars of each size parked in;the each level of the garage to the screen, in the following format. Also keep track of the;grand total, and display it after you have displayed the values for each car size.;b. Display an action menu with the following choices (see exceptions below);R ? Rent a car;T ? Turn in a car;E ? Exit the program;If no cars are available for rental, do not display or accept choice R.;If the garage is completely full, do not display or accept choice T.;HINT: Use a function to read, validate, and return a valid user choice.
Paper#68889 | Written in 18-Jul-2015Price : $32