Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Picture a car dealership. There are many different types of vehicles for sale. The salespeople know every detail about every one. But the accountants

C++

Picture a car dealership. There are many different types of vehicles for sale. The salespeople know every detail about every one. But the accountants inside only care that a vehicle is getting sold. Model this system:

  1. The dealer sells Hatchbacks and Sedans
  2. These both inherit from Vehicle, and Vehicle cannot have properties. It can have methods, virtual methods, or pure virtual methods.
  3. Every vehicle has a price
  4. Hatchbacks have 5 doors and sedans have 4
  5. Every vehicle has a trunk. A hatchback holds 30 cu ft, a sedan 20
  6. Lastly, every vehicle can be started

Make two functions that take a Vehicle pointer as an argument*. Call one Salesperson and the other Accountant.

void Salesperson(Vehicle* tWhat); void Accountant(Vehicle* tWhat);

The salesperson function:

  1. Prints the type of car
  2. Prints how many doors it has
  3. Prints the trunk size
  4. Starts the car

The Accountant function:

  1. Prints the price

PS: If these functions were in a class, they'd be methods. No Sales or Accountant classes.

Have separate header files for each class.

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago

Question

3. Identify the methods used within each of the three approaches.

Answered: 1 week ago

Question

a. When did your ancestors come to the United States?

Answered: 1 week ago