Question
Practice Programming in C++ Language Construct a program that is consisted of three classes: Car, Body, and Wheels. Please read the instructions below CAREFULLY! NOTE!
Practice Programming in C++ Language
Construct a program that is consisted of three classes: Car, Body, and Wheels. Please read the instructions below CAREFULLY!
NOTE! Your program MUST include the following functions:
addWheels()- adds a new Wheel object to your car (USE A VECTOR). A required condition you need is that if you already have added the max number of Wheels for the given Car body size, the message should output You have already added all the Wheels that can fit!
isItBuilt()- returns a Boolean for whether or not the Body and all Wheels have been added
testDrive()- will take the Car for a test drive. The integer it takes in should be the mileage you want the Car to travel. (Note: mileage affects the price of the Car).If the value entered is greater than the Wheel with the least mileage left, you should display the output You Broke down. After every drive print You drove x miles where x is the amount traveled. If you broke down, this value could be different from the value passed into the function. Also, make sure to change the condition of the Wheels based on their mileage left. If above 50,000 they are great. If above 25,000 they are moderate.
Display() should print all the information of an Car and its Body and Wheels.
getBody()- just return the current Car Body.
Body Class:
- Store the data for the size of the Body (small, medium, large)
- The condition of the Body (poor, moderate, great)
- The number of Wheels it can fit. The number of Wheels it can fit directly depends on the on the size of the Car. If the Car is small, it will have threeWheels. If it is medium it will have four Wheels, and if it is large it will have eight Wheels.
- The default constructor for the Body should be a medium sized Body that is in moderate condition. You also need three more constructors, one that will allow you to set a size for the Body, one that will allow you to set a condition for the Body, and one to get the number of Wheels.
Wheels Class:
The Wheels class must contain variables for the following:
- Mileage left
- The condition of the Wheel (poor, moderate, great)
- The default condition for Wheels must be moderate. A moderate Wheel must have 25,000 miles available, a great Wheel must have 50,000 miles available, and a poor Wheel must have 10,000 miles available. Once again, create a default constructor and an additional constructor that overrides the default condition of the Wheel.
Car Class:
The Car class is the final product. consisting of the other objects. You must store the following:
- Price
- Wheels
- a Body
- Can it be driven? (Boolean).
The condition of the Body and the condition of the Wheels will determine the price of the Car. The initial price of all Cars is 100. The Body will apply a scale of 4, 8 or 12 to this, depending on its condition. The condition of each Wheel will apply a scale of 3, 4 or 5. Also, a Car becomes drivable once it has the appropriate number of Wheels added.
An example: A great, small chassis with 2 poor wheels and 1 moderate wheel. Bolded is the wheel multipliers (3 of them). 100 * 12 * (3 * 3 * 4) = 43,200.
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