Provide appropriate accessor methods to set and get the data

Assignment Help C/C++ Programming
Reference no: EM131309035

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.

 

 

Reference no: EM131309035

Questions Cloud

What would be the impact on interest rates : Many argue that this was the position of the U.S. economy in 2003. If the Fed decided to expand the money supply in the graph, what would be the impact on interest rates?
Write a competitive analysis in a marketing plan : Which is more important? A market analysis or a competitive analysis in a marketing plan?
Types of immigrants better for america : 1. Is it good or bad that immigrants are willing to work for less? Why? 2. Are some types of immigrants better for America than others? Why? 3. What are the differences in the effects of illegal vs. legal immigration?
What does this imply about the forward premium : Assuming interest rates in country A are normally substantially higher than interest rates in country B. What does this imply about the forward premium or discount of country B's currency?  Would you frequently hedge your exposure to B's currency?
Provide appropriate accessor methods to set and get the data : Provide the appropriate accessor methods to set and get the data for each of these class variables. For example setYear(int year) and getYear().
Convert generic headings to talking headings : From a preliminary outline for a report, you have the following major and minor generic headings.- Convert these to talking headings that you'll include in your final report.
What is the equivalent annual cost of the tool : A precision lathe costs $24,000 and will cost $34,000 a year to operate and maintain. If the discount rate is 16% and the lathe will last for 4 years, what is the equivalent annual cost of the tool?
Discuss about the business marketing : According to Lamb et al. (2014), business marketing differs from marketing to consumers only in terms of the use of the products or services - leaving out the consumer. Business marketing entails marketing to persons and businesses who will then o..
Role of a small-business consultant : Place yourself in the role of a small-business consultant. One of clients, Home Solutions, is considering opening two new stores. You know that businesses often experience cash flow problems due to continuous changes that occur in the industry, su..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Take an n x n matrix, and create a new, (n-1) x (n- 1)

take an N x N matrix, and create a new, (N-1) x (N- 1), matrix with each element being the sum of four nearby elements. You need to figure out a way to break the matrix up into squares and iterate through the matrix, while staying within its bounds.

  Create a program that maintains the required book catalog

create a program that maintains the required book catalog for the circulation desk of a library. the book catalog is to

  Create the program which converts fahrenheit to celsius

Create the program which converts Fahrenheit to Celsius -  Read integer Fahrenheit temperatures from the user. You need to check whether the input is the correct one or not. If the user enters the incorrect number, ask it again.

  Compare and contrast the meaning ofenterprise architecture

Compare and contrast the meaning ofenterprise architecture versusdistributed system? Provide at least 1 example each of enterprise architecture and a distributed system? Discuss the advantages and disadvantages of distributed systems in a business en..

  Write a program to generate a table of factors

Write a program to generate a table of factors used to compute monthly payments for the money borrowed.

  Program that will calculate the heat transfer of a substance

write a program that will calculate the heat transfer of a substance (water) given three different shapes. The user has to be able to input the type of shape, so that the computer can calculate area, and plug it back in to the equation for heat trans..

  Chess program, enable a monitoring component

Given a chess program, enable a monitoring component to switch planning algorithms at runtime, based on the opposing player's style and response time.

  The two major modifications are the instruction of pointers

the two major modifications are the instruction of pointers and the calculation of mortgage interest rates.requirements

  Linked listsnbspalong with vectors linked lists are one of

linked listsnbspalong with vectors linked lists are one of the fundamental data structures in computer science. unlike

  Create a c++ binary search tree

Create a C++ Binary Search Tree that will accept integers in this order: 35, 18, 48, 72, 60, 25. Ask user for input and search tree utilizing integer input. Return "True" if input integer is found or "False" if it is not found in tree.

  Write an accessor function to get the angle

Write a friend function to compare the area of a rectangle with sides 12 and 8 to the area of a parallelogram with sides 14 and 18 and an acute angle of 40 degrees. Test it in main, and check the answer by hand.

  Calculate the charge for daytime phone minutes

Draw a typical hierarchy chart for a program that produces a monthly bill for a cell phone customer. Try to think of at least 10 separate modules that might be included. For example, one module might calculate the charge for daytime phone minutes ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd