Question: a) Define class Date that has the following data members, int month, day, year. b) Each vehicle is assigned a unique id. Define class Car

a) Define class Date that has the following data members, int month, day, year.

 b) Each vehicle is assigned a unique id. Define class Car with data member, int unique_id

c) Derive NewCar class from Car class with the following additional data members, • int model_year • color of the car as a standard library string. • int no_of_doors • double price

d) Derive UsedCar class from NewCar class with the additional data members, • manifacturer of the car (e.g., Ford, Toyota) as a standard library string. • int milage

e) Define class Person with the following data members, • name as a standard library string • date_of_birth as an object of Date class

f) Derive class Client from class Person with the following additional data members, • driving_licence as a standard library string. • type_of_car (new or used) as a library string that client is asking

g) Derive class SalesPerson from class Person with the following additional data members, • date_of_hire as a standard library function • double salary

h) Define a class PurchaseContract that stores information about purchase of a car, client, salesperson and the car. Car may be either a new or used car. The class should have the following data members,

• A pointer to an object of Client class • A pointer to an object of SalesPerson class

• A pointer to an object of NewCar class (if client purchases a new car this will point to that car object otherwise will be set to a null value)

• A pointer to an object of UsedCar class (if client purchases a used car this will point to that car object otherwise will be set to a null value) • date_of_purchase as an object of Date class i) Define class dataManager that stores information about cars and sales. The class will have the following data members,

• A pointer array of NewCar objects called newcarArray of size 50.

• A pointer array of UsedCar objects called usedcarArray of size 200.

• A pointer array of SalesPerson objects called salespersonArray of size 10.

• A pointer array of PurchaseContract objects called pcontractArray of size 100. The above arrays should be initialized to null values. The class should provide at least the following member functions with the given prototypes,

• Insert function to add a new SalesPerson object to the salespersonArrray. bool insertSalesPerson( SalesPerson *)

• Insert function to add a new NewCar object to the newcarArray. bool insertNewCar( NewCar *)

• Insert function to add a new UsedCar object to the usedcarArray. bool insertUsedCar( UsedCar *)

• Insert function to add a new PurchaseContract object to the pcontractArray. bool insertPurchaseContract( PurchaseContract *)

• A function that receives a NewCar object with given color and model year and checks its availability. bool checkavailability(NewCar &)

• A function that receives a UsedCar object with given color and model year and checks its availability. bool checkavailability(UsedCar &)

• A function that prints information about all the used cars under certain age. void printAge(int)

• A function that prints information about all the used cars under certain milage. void printMilage( int)

j) Write a driver program that demonstrates functionality of your program. All the classes should have print functions.

- Creates an object of dataManager class.

- Creates NewCar, UsedCar, PurchaseContract objects and insert them to their arrays.

- Prints inventory of new and used cars.

- Prints information about all the purchase contract objects.

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Question Description a Define class Date that has the following data members int month day year b Each vehicle is assigned a unique id Define class Car with data member int uniqueid c Derive NewCar cl... View full answer

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 Algorithms Questions!

Related Book