Question: Use the code program below to make the data in your program persistent by storing all car and rental records into separate files and using

 Use the code program below to make the data in your

program persistent by storing all car and rental records into separate files

and using the information when the program starts up. The program must

implement four new functions void write Rentals(char filename, Rental allRentals, int totalRentals);

int readRentals(char filename, Rental allRentals); void writeCars(char filename, Car *allCars, int totalCars);

Use the code program below to make the data in your program persistent by storing all car and rental records into separate files and using the information when the program starts up. The program must implement four new functions void write Rentals(char filename, Rental allRentals, int totalRentals); int readRentals(char filename, Rental allRentals); void writeCars(char filename, Car *allCars, int totalCars); int readCars(char filename, Car "allCars) Use the command line arguments to read two text strings from the command line when the program is started. The first string must specify the file name of the rental records file, the second string specifies the file name of the car records file. The program must call the two read functions. Note, the previous call of createlnventory() in main() is no longer needed as the car inventory is read from a file Before the program terminates, it must store the rental and car records using the corresponding functions For implementing the functions, you must use text-based file I0. When you create the file to write rental or car records to the file, begin by writing the entire record on a single line with eaclh field separated by one space using fprintf), then continue with the next record the same way u all records have been written to the file. You should have as many text lines as records. For example, the format for the 3 cars specified in the project description of project 4 should look asfollows 1234 VW Golf 2 66.00 2241 Ford Focus 4 45.00 3445 BMW X3 4 128.00 You may assume that none of the text strings for make or model contains spaces in their names (so %s in fscanf will work). For reading the records, do the same but use fscanf() to read numbers or strings for the individual fields of records. Assume that each record is completely stored in the file. If you reach the end of a file, then you should have a complete count of records that have been successfully read. Return that number as the number of rentals or cars. Your program must be robust to handle empty text files or missing files

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!