Question: Please do this in C++, comments that help in explaining are greatly appreciated! I will definitely thumb up your hard work if the code runs.

Please do this in C++, comments that help in explaining are greatly appreciated! I will definitely thumb up your hard work if the code runs.

Write a well-structured, readable, clean code that deals with Vehicles and Shapes! Do not worry they are related. Mainly, you have two vehicles: a BMW and a Mazda. You also have two types of shapes: a Rectangle and a Circle. Your code can draw any Shape or Vehicle. So, both the Shapes and Vehicles have to be Drawable.

How about the BMW and the Mazda!! How can we draw them? the limit is your imagination!

Requirements: 1- Design, implement and test a draw function that can draw any of your shapes and vehicles.

2- Design, implement and test a drive function that can drive any of your vehicles. a. For simplicity driving a BMW can be represented by printing: Driving a BMW.

3- Design, implement and test Rectangle and Circle classes: a. They have a function to calculate their area. b. They can be drawn using the draw function.

4- Design, implement, and test BMW and Mazda classes: a. They can be drawn using the draw function. b. They can be driven using the drive function.

5- Design, implement and test a function called getTotalArea. This function accepts an array as an input argument. The array elements can be pointed to Rectangle or Circle. The function returns the total area of all the shapes passed to it! a. Test this function by creating four shapes (two Rectangles and two Circles) that have different areas.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!