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
The car’s measurements are illustrated, using two arrays. Array 1 = {L, R, L, R, R, L, R, R, L, R, R, L, R, L, L, R, Z}

Ask question #Minimum 100 words acceptedEducational Objectives: After completing this assignment, the student should be able to accomplish the following: Apply generic algorithms i

Write a c program to determine interchanged values between two variables?[Hint - if loop] What will be the output of the program? How many times this loop will execute? Wr

Help for tomorrow...?

P r i va t e Member Functions: A private member functions can be called by the members of the same class.  Consider the following example.   c l a ss sample

Suppose that three integer variables intA, intB, and intC have already been defined at the beginning of the main function, write a single C++ statement to read three integers from

find area under the curve y=f(x) between x=a &y=b integrate y=f(x)

A: No. Syntax wise it is permitted. But then the function is no longer Inline. Since the compiler will never know how deep the recursion is at compilation time.

Write three functions in C or C++: one that declares a large array statically, one that declares the same large array on the stack, and one that creates the same large array from t

1)      Factorial (for this question just provide an answer for each part)  1.1  Debug the following program to calculate N! #include using namespace std; main()