Answered step by step
Verified Expert Solution
Question
1 Approved Answer
im having trouble with the drive function that need to be coded. C++ Chassis For this assignment, main.cpp wil be provided for you, so you
im having trouble with the drive function that need to be coded. C++
Chassis For this assignment, main.cpp wil be provided for you, so you don't have to worry about the structure of the program. Instead, you can focus solely on the structure of the classes and their interactions. I suggest looking at main closely, to help you understand the structure of the project. Chassis The Chassis class is the backbone of your vehicle. You will need to store the following data: - The size of the chassis (smail, medium, large) - The quality of the chassis (poor, fair, good The number of wheels it can support The number of wheels a given chassis can support is dependent on the size of the vehidle. If the vehicle is small, it functions with 3 wheels (the tri-wheeled wonder). If it is medium, 4 wheels are required. If the vehlicle is large, you will need to have 6 wheels The default constructor for the chassis will insure it is a medium sized chassis of fair quality. You will also need to implement two more constructors, one that will allow you to specity a size for the chassis, and one that will allow you to specity a size and quality for the chassis Finally, you will need a getter method for the number of wheels called getNum/Wheels) Wheels Your Wheel class should contain variables for the following Mileage Left Condition the wheel is in (poor, fair, good) The default condition for Wheels made will be fair, A fair wheel will have 10,000 miles available to it at the start. A good wheel will have 20,000 and a poor wheel will start with 5,000 You will once again need a default constructor and a second constructor that overrides the condition of the wheel. Vehicle The Vehicle class will be the finished product of your production line, being comprised of the other objects defined below. You will need to store the folowing data: The price e Wheels A Chassis (body of car) Is it drivable? Boolean) The quality of the chassis and the condition of the wheels will determine the price of the vehicle. The base price of all vehicles is SoD. The chassis will apply a multiplier of S,8or 12 to this, depending on its quality Likewise, the quality of each wheel will apply a multipler of 1.5, 1.8 or 2.2. (Maybe price should be a float to account for this?). Additionaly, a vehicle only becomes drivable once it has the appropriate number of wheels added to it An example: A good, small chassis with 2 poor wheels and & fair wheel Bolded is the wheel multipliers of them). 00 12 (1.5 1.5 2.2)-29,700 in addition to the above, you will need to implement the following methods void addwheeL(Wheel whee) void Display) bool isBuilt); void Drive(int) Chassis getChassis Vehicle(Chassis): addWheel) will is fairly self -explanatory, adding a new wheel object to your car (consider using a vector for this). An additional condition is that ifyou have already added the max number of wheels for the given vehicle (chassis sizel, the message "You've already added all the wheelst" should be displayed isBuilt)should return a Boolean as to whether or not the to the vehicle. Drivel)will give your car the ablity to go for a test run. The integer it takes in should be the mileage you want the vehicle to travelif the value entered is greater than the tire with the least mileage left, you should display the output Broke Downl". After every dirive print "You've traveled x miles" where x is the amount traveled. If you broke down, this value could be different from the value passed into the function. Additionally, make sure to change the condition of the wheels based on their mileage left. If above 10,000 they are good. If above S,000 they are fair Below that you have poor wheels. Keep in mind, a change in condition also means a change in price for the vehicle! Finally, if you attempt to dirive the vehicle before it is built, the message e chassis and all wheels have been added Vehicle not built.Literaly un -drivable" should be displayed getChassis(l should just return the current vehicle's chassisStep 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