Provide the appropriate accessor methods to set and get the


Assignment

Overview

This assignment consists of implementing an application using the techniques learned in the first half of the course. Examples on how to use file operations, random number generation, the standard template library.

Your program must compile and you must provide all of the source code files so that I can also compile and run your program (e.g. provide me with all files ending in .h and .cpp that are necessary to compile your program). You may use any resources, books, or notes. Apart from your textbook and provided examples, you must mention all resources that you use as comments next to the applicable lines of code or the appropriate functions within your source code or within the main comment at the top of your source code file.

Implementation

The program will consist of implementing a vehicle tracking system for a rental car company. The implementation will include several attributes related to each vehicle in the rental car company's inventory, and the data will be managed in a global linked list in memory. The program must use the "list" API in the C++ standard template library. All of the attributes associated with each vehicle will be stored as a single object within a global linked list data structure. The program must implement at least one class that will hold the following variables:

 

recordId -

An integer that consists of a number starting at 100 for the first vehicle in the linked list and automatically incremented by 1 for each subsequent vehicle entered into the linked list. The user will not enter this number.

VIN -

A string to represent a fictitious vehicle identification number (VIN) associated with the given vehicle. The fictitious VIN will consist of a randomly generated set of 17 characters and numbers. The fictitious VIN must be in the format:
CCCC###CC##CCC##C
where C is a randomly generated character and # is a randomly generated number. Again, the user will not enter the fictitious VIN.

year -

An integer consisting of the four digit year that the vehicle was made. The program must re-prompt the user to re-enter the year if it is not a valid four digit year from 1906 - 2016.

make -

A string to indicate the make of the vehicle. For example, Ford, Toyota, etc.

model -

A string to indicate the model of the vehicle. For example, F150, Prius, etc.

color -

A string to indicate the color of the vehicle.

mileage -

An integer to hold the current odometer mileage for the vehicle.

forSale -

A Boolean flag to indicate that the vehicle can be put up for sale. This flag will automatically be set by the program if the entered mileage is over 100,000 miles. The user will not enter the data for this field.

Provide the appropriate accessor methods to set and get the data for each of these class variables. For example setYear(int year) and getYear(). The main program must provide the following functionality:

When the program is first started, it must read a data file called rentalCars.dat. The program should not prompt the user for the name of the data file. If the file exists, the program will load the data for each vehicle entry into the global linked list data structure. If the file does not exist, the program will start with an empty linked list.

Provide a simple text-based user interface similar to the Book Inventory example that manages the all of the vehicle entries in the global linked list. Each vehicle entry must be placed in this global linked list as an object that holds all of the information
associated with a given vehicle. The program interface will allow the user to do the following:

Display Inventory - displays all of the vehicles in the global linked list. This feature will display all of the fields associated with the each vehicle entry. In addition it must also print the total number of vehicles that are in the linked list.

Enter Vehicle - allows the user to enter all of the fields associated with a given vehicle, except for the recordId, VIN, and forSale fields. These fields will be automatically generated by the program as previously mentioned. After the data fields are entered, the program will place the vehicle entry in the global linked list data structure that is kept in memory.

Delete Vehicle - allows the user to delete a vehicle from the linked list using the recordId as the key. The program will display a message if the entry is not found in the linked list.

Search by Make - allows the user to find and print all of the vehicles for given vehicle make. The program will prompt the user to enter the vehicle make and will display a message if there are no vehicles in the global linked list for a given vehicle make.

Modify Vehicle - allows the user to modify all of the fields for a given vehicle entry (except for the recordId, VIN, and forSale) in the linked list. The program must use the VIN as the key to find the entry to modify. For simplicity, the program may re-prompt the user to re-enter all of the fields associated with a vehicle; but it must reuse the recordId, VIN, and forSale values. Display a message if the vehicle is not found in the linked list.

Exit system - before the program exits, it must save all of the data in the linked list to the data file. I recommend using a standard text file with one field per line. At this point, if the file does not exist, the program will create it.

Hints and Tips

First, work on the feature that allows the user to enter a vehicle along with all of its fields. Next, work on the display feature that will show all of the vehicles and their associated data contained within the linked list. Next, make sure your program can read and write one record to and from the data file. Then expand the program to read and write all records to and from the data file. The data file functions for this can be modeled after those in File Operations example and the display and enter functions that you will create. Finally, work on the search, modify, and delete features.

 

 

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Provide the appropriate accessor methods to set and get the
Reference No:- TGS01711714

Now Priced at $45 (50% Discount)

Recommended (92%)

Rated (4.4/5)