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

#padovan string   program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class PadovanString {

WHAT IS A C LANGUAGE? C IS A PROGRAMMING?

Program to convert fraction to decimal: int main() {                 float num, denom;     // numerator and denominator of fraction                 float value;

for different operation multiple stack


Problem : Change to palindrome A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your ta

Is it possible to pass an entire structure to functions? Yes, it's possible to pass an entire structure to a function in a call by method style. Some programmers prefer to decl

C Program to FIND THE EVEN WORDS IN THE STRING #include conio.h> #include stdio.h> void main() {           char a[50],temp;           int i=0,k=0,l[25],c=0,r=0;

I want a Reverse engineer a .exe to obtain the code Project Description: I'd like to get the full C++ source code from a .exe please Skills required is C++ Programming