Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called Person. Class Person has one private member variable, string name. Class Person has a parametrized constructor that accepts the argument for

Create a class called Person. Class Person has one private member variable, string name. Class Person has a parametrized constructor that accepts the argument for name and sets the value of the member variable name. Class Person has one accessor member function getname() that return the value of name. Class Mechanic inherits from class Person. Class Mechanic has one private member variable, string expertise. Class Mechanic has a parametrized constructor that accepts the arguments for name and expertise and passes name to the base class constructor and sets the value of member variable expertise. Class Mechanic has one public member function getexpertise() that returns the description of the member variable expertise. Class Customer inherits from class Person and has two private member variables, string car that holds the make, model and year of the car in a single string and a pointer to class Mechanic *mptr. It has a parametrized constructor that accepts arguments for name, car and mptr and passes name to base class constructor and sets the values of member variables car and mptr. Class Customer has a public member function getcar() that returns the value of member variable car and another public member function getmechanic() that returns the name of the mechanic for that customer. In a client program, create two Mechanic objects and three customer objects. Display the customers name, make, model, year of the customers car and the name of that customers mechanic. Also, separately display the name of each mechanic and his/her expertise. Note: You must pass the address of one of the Mechanic object to the Customer objects mptr member variable to assign that mechanic to that customer

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

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions