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
Define How Passing Arrays to a Function? A complete array can be passed to a function as an argument. The manner in which the array is passed be different from that of an ordin

Function Templates Function templates give you with the capability to write a one function that is a skeleton, or template, for a family of similar functions. In function ov

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 task is to convert S to palindrome

how would land elevation have changed if Coronado had traveled 150 miles due west from what is today Arizona instead of east toward New Mexico

(a) client server or multithreaded client-server, where server will create pool of worker threads (say 5) to provide services to pool of clients (say 5 ).Server should be behaving

Is it probable to encompass Virtual Constructor? If yes, how? If not, Why?

Question 1) What are the commonly used input/output functions in C? Question 2) What is the difference between function declaration and function definition? Write a recursive


Conversion between Objects of Different Classes As the compiler does not know anything about the user-defined type, the conversion instructions are to be specified in a functio

Define a function in c program: int f1() { static int x=10; return x; } int f2() { int y=5; return y; } extern int z; void f()     {