Write a code to implement the base and derived class, C/C++ Programming

Assignment Help:

Study the given hierarchical class diagram and additional information, and answer the questions that follow:

Sale

Company: string

unitPrice: double

qty: int

salesAmt: double

Sale(string, double, int);

getCompany():string;

getUnitPrice():double;

getQty():int;

getSalesAmt():double;

computeRevenue():double;

HardwareSale

installFee: double

hWSale(string, double, int, double)

computeRevenue():double

Sale(string, double, int); 

Constructor  that initializes the respective data members to the pass in values.  salesAmt is set to 0.

getCompany():string;

Returns the company

getUnitPrice():double;

Returns the unit price

getQty():int;

Returns the quantity

getSalesAmt():double;

Returns the sales amount

computeRevenue():double;

Sets  sales amount = unit price * quantity.  Returns this computed value.

hWSale(string, double, int, double)

Invokes the base class constructor and sets install fees accordingly

computeRevenue():double

Sets  sales amount = unit price * quantity + install fees

(a)  Write  the class specification and  code to implement the following classes, fulfilling the given requirements:  

(i)  Sale (base class)

 (ii)  HardwareSale(derived class)


Related Discussions:- Write a code to implement the base and derived class

When i develop a destructor, When I develop a destructor, do I require to e...

When I develop a destructor, do I require to explicitly call the destructors for my member objects?

Explain the preprocessor directives, The Preprocessor Directives A prep...

The Preprocessor Directives A preprocessor directive which starts with a hash '#' ,is an instruction to the preprocessor, which acts on the source code before the compilation p

Assignment, write a c program chat illustrates the creation of child proces...

write a c program chat illustrates the creation of child process using fork system call. One process finds sum of even series and other process finds sum of odd series.

''c'' programme, Write a ''C'' program to accept any 3 digit integer number...

Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

Define the data types of c language, Define the Data Types of c language? ...

Define the Data Types of c language? The C has a concept of 'data types' which are used to define a variable before its use and the definition of a variable will assign storage

Car rental system, Car Rental System This system tracks cars in a rental co...

Car Rental System This system tracks cars in a rental company. Each car has a number (assume its plate number), type (small car, four wheel car), and status (rented, available). T

Luminous Jewels - The Polishing Game, 1. Jewels can only be removed for pol...

1. Jewels can only be removed for polishing from either end of the necklace (i.e. head or tail) 2. Once a jewel type is removed from the necklace, all other instances of the same j

#accept 3 digit number, Write a ''C'' program to accept any 3 digit integer...

Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number

Bankers algorithm, creating a system having five process from p0 to p4 and ...

creating a system having five process from p0 to p4 and five resource types. create the need matrix use the safe algorithm to test if the system is in safe mode.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd