Question
For Programming Assignment 3, you will be creating a program to manage cars in a dealership. Your program will be class based with the following
For Programming Assignment 3, you will be creating a program to manage cars in a dealership. Your program will be class based with the following UML representing the classes:
Dealer
- DealerName: string
- DealerAddress: string
+ setName( input:string): void
+ setAddress(input:string ): void
+ getName( ): string
+ getAddress( ): string
+ Dealer ( );
+ Dealer ( iName:string) ;
Vehicle
- VIN:string
- make:string
- model:string
- year:int
- price:double
+ DealerPtr: Dealer * //Note this should be in the public area
+ Vehicle(iVIN:string, iMake:string, iModel:string, iYear:int, iPrice:double)
+ Vehicle( )
+ getVIN( ):string
+ getMake( ):string
+ getModel( ):string
+ getYear( ):int
+ getPrice( ):double
+ setVIN(input:string):void
+ setMake(input:string):void
+ setModel(input:string):void
+ setYear(input:int):void
+ setPrice(input:double):void
+ friend operator << (out: ostream &, Vehicle: car 1):ostream &
Note: Don't forget to allocate the new Dealer if either the Vehicle constructor or default constructor is called.
You will have four files for your program (Use these file names!): main.cpp, functions.h, vehicle.h, vehicle.cpp. Place all files into a file folder named LastnamePA3, the zip the content and hand in a zip file!
main.cpp: this will be your driver file.
functions.h: this will contain your global functions for each of the menu items (display, addVehicle, deleteVehicle, updateVehicle, etc).
vehicle.h: this will contain the class declarations for vehicle and dealer.
vehicle.cpp: this will contain the class implementations for vehicle and dealer.
You will be storing your vehicle objects in a vector. In the main function, you will create a vector of vehicles with an initial size of zero (0).
You will not have any global variables.
This will again be a menu driven system. When the menu options are called, you will have to check your vector and ensure that it has a vehicle in it before the function continues (error checking). The following is your menu:
Display Inventory
Add a vehicle
Update a vehicle
Delete a vehicle
Sort inventory by VIN
Search inventory by Model
Read inventory from file
Write inventory to file and exit
Each menu item will have a corresponding function, and the definition of the function will be found in the file functions.h. Each function will only have one parameter, the vector. All I/O will be done in the functions and not in main (expect asking for what menu option the user wants).
The following are the details for each of your menu options:
You will display each vehicle, using the following format:
Vehicle: #
VIN: VVVV
Make: MMMM
Model: MMMM
Year: YYYY
Price: $D.CC
Dealer Name: DDDDDD
Dealer Address: AAAAAAAAAA
The bold face letters represent the values for the individual vehicle, and it doesnt have to be bolded. Notice the tab stop between the label and the value. Also notice that there is a dollar sign and decimal for the price. Lastly, for Vehicle: #, the pound sign represents the vehicle position number in the vector (starting at 1 not 0), which will be 1, 2, 3 and so on.
2. You will ask the user for all of the information to add the vehicle (including the information of its dealer) and then you will add it to the vector.
3. You will display the vehicles and then ask the user which vehicle to edit. They will give you the index number (starting at 1). Check to ensure they gave you a valid entry, then prompt for which item they want to edit (year, make, model, price, or VIN). Once they make their selection prompt for the new information, then return to the main menu.
4. You will display the vehicles and then ask the user which vehicle to delete. They will give you the index number (starting at 1). You will then check to ensure they gave you a valid entry and then remove that vehicle from the vector.
5. You will sort the vector by VIN number (when sort is done, the vector in main will be sorted by VIN number).
6. You will ask the user for a model, then search the vector for that vehicle. You will return the first matching entrys index number or an appropriate message if not found.
7. You will read the inventory from a file called inventory.txt, which is NOT provided for you (you will need to make your own to start with). The data is stored in the same order as listed above and is newline delimited (like the example below).
34ABC321B BMW 328xi 2016 41315.00 Schomp BMW Littleton, CO
8. You will write the entire inventory out to a file called inventory.out (using the << operator) and then exit the program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started