Hi, I attached the instructions. Thank you
The objective of this assignment is to demonstrate composition in object-oriented programming. Do not try to implement this program using inheritance. That is for a later assignment.
You are working for a major car manufacturer and have been tasked with creating an application to maintain vehicle inventory records for one of its dealerships.
Create a class to maintain a
. A dealership has the following information that must be stored in the Dealership class: the dealership name, the maximum number of vehicles that the dealership’s lot can hold, and a vector of the vehicles currently on the lot.
The information for each vehicle should be encapsulated in a
class and should include the vehicle’s make, model, and year. Your
class should support operations (functions) to add a vehicle to the dealership’s inventory (vector) and to list all vehicle records (i.e. print out the make, model, and year of each vehicle object in the vector). Your
class should include operations to allow entry of the make, model, and year, and to return the values in these variables (In other words, you need a separate setter and getter for each data member in the Vehicle class).
You should write a main program that creates a single Dealership object and presents a menu to users that allows them to select either Add (A), List (L), or Quit (Q).
should allow the user to enter a vehicle’s information (make, model, and year) and add it to the dealership’s inventory (vector) of vehicles.
should list all vehicle records currently in the dealership’s inventory. Remember that a vehicle record includes the make, model, and year of the vehicle.
· You should be able to add and list repeatedly, until you select Q to quit.
Use good coding style and principles for all code and input/output formatting. All data in a class must be private. Put each class declaration in its own header file and its implementation in a separate .cpp file.
How to approach this lab:
1. In main():
a. Prompt the user to enter a name for a dealership and its lot capacity.
b. Create an object of the Dealership class, passing in the name of the dealership and its lot capacity as arguments to the constructor of the Dealership class.
c. Create a menu with “cout” statements.
d. Create a switch statement that contains the cases that the user could enter. (i.e. Add (A), List (L), and Quit (Q))
e. For the Add vehicles case, call a function in the Dealership class to add a new vehicle to inventory if the number of vehicles already in inventory is less than the maximum number of vehicles that can be displayed on the lot (lotCapacity). [Note: As a matter of usability, you should not prompt the user to enter in a make, model, or year of a vehicle if no new vehicles can be added to inventory. You never want to waste the user’s time entering data that will not be saved.]
f. For the List vehicles case, call the function in the Dealership class that prints vehicle records.
2. In the Dealership class:
a. Make sure you have a constructor that initializes the Dealership name and lot capacity.
b. You should also have a default (zero-argument) constructor and a destructor. Even if you don’t use the default constructor, it’s always a good idea to have one in your classes (you’ll see why when we dive into inheritance).
c. Separate setter and getter functions are needed for the dealership name and lot capacity variables.
d. A function to return the number of vehicles currently in the vector should also be included.
e. The Dealership class must contain a function (addVehicle) to add a vehicle. In it, you will prompt the user to enter the make, model, and year of a vehicle and create a new Vehicle object (passing in all of this information to the constructor of the Vehicle class) and add it to the vector of Vehicle objects (which is a data member in the Dealership class).
f. The Dealership class must contain a function (listVehicles) that will print each Vehicle object in the Dealership class. That is, loop over all the Vehicle objects in the vector and for each object, call a function in the Vehicle class that will print each vehicle’s record (make, model, and year). It’s like using Dealership as a middleman… main() calls a function in the Dealership class to list the vehicles assigned to that dealership. This function in the Dealership class loops over each Vehicle object in the vector. Within the loop, each Vehicle object calls a function in the Vehicle class to print out the make, model, and year of the object.
3. In the Vehicle class:
a. Make a constructor that initializes the vehicle’s make, model, and year passed in from your Dealership function that adds a new vehicle.
b. Create a default constructor and a destructor.
c. Create separate setter and getter functions for each data member in the class.
d. The Vehicle class will contain a function that displays the make, model, and year for a vehicle. This function will be called from the function in the Dealership class that prints out each Vehicle object.
A picture says a thousand words…
Perhaps this visual depiction will help your mental model of composition:
This is how the running program should look: [Note that the name of the dealership can include a space, and lot capacity should be numeric and positive.]
Error message if the user tries to add another vehicle after capacity has been reached:
· Complete the programming assignment described above and submit your completed assignment in accordance with the assignment submission policies.
To give you an idea of the general criteria that will be used for grading, here is a checklist that
you might find helpful:
Compiles and Executes without crashing
Word document contains screen shots and integrity statements
Appropriate internal documentation
No global variables
Code is modular
Appropriate Pre-processing and using directives
Member functions and variables are declared with appropriate
protection (i.e. private or public)
Five separate files are created for the program: Dealership.h(header file), Vehicle.h (header file), Dealership.cpp (class implementation file), Vehicle.cpp (class implementation file), and DealershipDriver.cpp (driver file)
Appropriate data members are declared in both classes
Constructor(s) as appropriate in both classes
Member functions are correct and exist in the correct classes
Error checking is performed on input data where needed: Program outputs appropriate error messages; does not close until the error message can be read; indicates the problem with the invalid item.
Add: Successfully adds a Vehicle record
Allows no more Vehicle records than the maximum lot capacity
List: Lists all the data
Loops until the user selects quit
Processing and Outputs
Output is formatted neatly
Page 2 of 2
Why Choose Us
- 100% non-plagiarized Papers
- 24/7 /365 Service Available
- Affordable Prices
- Any Paper, Urgency, and Subject
- Will complete your papers in 6 hours
- On-time Delivery
- Money-back and Privacy guarantees
- Unlimited Amendments upon request
- Satisfaction guarantee
How it Works
- Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
- Fill in your paper’s requirements in the "PAPER DETAILS" section.
- Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
- Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
- From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.