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

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)

Posted Date: 3/23/2013 6:42:52 AM | Location : United States







Related Discussions:- Write a code to implement the base and derived class, Assignment Help, Ask Question on Write a code to implement the base and derived class, Get Answer, Expert's Help, Write a code to implement the base and derived class Discussions

Write discussion on Write a code to implement the base and derived class
Your posts are moderated
Related Questions
Is it possible to create your own header files? - Yes, it's possible to create a customized header file. - To do this, you just need to include function prototypes that you

a) Define an Asset base class that provides the following method: class Asset { public:      virtual double getValue()=0; };   This will be the base class for both stock an

A: Mostly can be overloaded. The only C operators which can't be are. and?: (and sizeof, that is technically an operator). C++ adds a few of its own operators, mostly which can be

I need help with a c# program. Do yall help with c sharp

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

you are to create a text adventure game that uses pointers. You have a rich, eccentric Uncle Billy who is soon to be deceased. How soon.....oops......he''s gone. He has left yo

Array of Objects: The objects can be declared just like a structure or even a primary data type.  Array of objects may be required to work with large set of data.   When the da

write a class player that contain attributes for the player,s name,average and team

Part 1 Assignment:  develop a calculator in MASM. Text chapters covered:  1 through 4, 5.4, 5.5, 6.3, 7.4 You will develop a "calculator" algorithm in MASM using reverse-

A container class is a class which is used to hold objects in external storage and memory. A container class work as a generic holder. A container class contains a predefined behav