Starting from:

$20

Rent A Car program Solution

For this project, you are to create a program that will assist users who want to rent a car. You are given a datafile with 10 different cars, and you must read in all of the car data from the file and store it in an array of structs. You must also create a menu with the functionality defined below. Although an example file is provided, for grading purposes your project will be tested against a different test file that will not be provided to you beforehand. Our test file will be in the same format as the example file.



The RentalCar struct will contain the following data members:

- make, a C-style string

- model, a C-style string

- year, an int

- price, a float (price per day)

- available, a bool (1 = true; 0 = false; try to display true/false using the "boolalpha" flag, optional)




The menu must have the following functionality:

- Read ALL data from file.

- Print out ALL data for all of the cars.

- Estimate car rental cost - prompt the user for a car number (first car in file should be

represented to the user as #1), and the number of days to rent the car.

- Find the most expensive car.

- Print out ONLY the available cars.

- Exit program.




The following minimum functionality and structure is required:

- Ask the user for the input file name.

- The list of cars must be stored in an array of structs.

- Use character arrays (i.e., C-style) to hold your strings. No string data type!

- Write multiple functions (Hint: each menu option should be a function).

- You can use pass by reference in your function.

- Write your own string copy, string compare (or other) functions as needed.

- The other functionality and structure of the program should remain the same as Project #1, including writing to screen and file and restrictions on string libraries, global variables and constants, etc.

More products