1. Engineering
  2. Computer Science
  3. c programming create a program that includes three classes called...

Question: c programming create a program that includes three classes called...

Question details

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 miles available. 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, and whether or not it is able to 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.

Here are some functions you should use that will be helpful:

addTires

getFrame

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 ittakes in should be the mileage you want the automobile to travel. (Note: mileage affects the price of the automobile)

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

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution