Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ PROGRAMMING: Create a program that includes three classes called automobile, frame, and tires. Each of these classes must do the following: Frame Class: Store

C++ PROGRAMMING:

Create a program that includes three classes called automobile, frame, and tires. Each of these classes must do the following:

Frame Class:

Store the data for the size of the frame (tiny, medium, big)

The condition of the frame (bad, decent, good)

The number of tires it can fit. The number of tires it can fit directly depends on the on the size of the automobile. If the automobile is small, it will have three tires. If it is medium it will have four tires, and if it is large it will have eight tires.

The default constructor for the frame should be a medium sized frame that is in decent condition. You also need three more constructors, one that will allow you to set a size for the frame, one that will allow you to set a condition for the frame, and one to get the number of tires.

Tires Class:

The Tires class must contain variables for the following:

Mileage left

The condition of the tire (bad, decent, good)

The default condition for Tires must be decent. A decent tire must have 25,000 miles available, a good tire must have 50,000 miles available, and a poor tire must have 10,000 milesavailable. Once again, create a default constructor and an additional constructor that overrides the default condition of the tire.

Automobile Class:

The Automobile class is the final product. consisting of the other objects. You must store the following:

Price

Tires

a Frame

Can it be driven? (Boolean).

The condition of the frame and the condition of the tires will determine the price of the automobile. The initial price of all automobiles is 500. The frame will apply a scale of 10, 16 or 24 to this, depending on its condition. The condition of each tire will apply a scale of 3, 4 or 5. Also, an automobile becomes drivable once it has the appropriate number of tires added.

Your program MUST include the following functions:

addTires - adds a new Tire object to your car (use a vector). Another condition you need is that if you already have added the max number of tires for the given automobile frame size, the message should output You have already added all the tires that can fit!

isItBuilt- returns a Boolean for whether or not the frame and all tires have been added

testDrive- will take the automobile for a test drive. The integer it takes in should be the mileage you want the automobile to travel. (Note: mileage affects the price of the automobile).

If the value entered is greater than the tire 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 tires based on their mileage left. If above 50,000 they are good. If above 25,000 they are decent.

Display should print all the information of an automobile and its frame and tires.

getFrame - just return the current automobile frame.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions