c++ Build a class Sale with private member variables double itemCost; // Cost of the item double taxRate; // Sales tax rate and functionality mentioned below: ● Write a default constructor to set the member variable itemCost to 0 and taxRate to 0. ● Write a parameterized constructor that accepts the parameter for each member Sale( double cost, double rate) ● Generate only accessors for itemCost and taxRate ● Write a function double getTax( ) to calculate tax i.e take a product of itemCost and itemRate. ● Write a function double getTotal( ) to calculate the total price of item i.e. take a sum of itemCost and getTax( ) (calling getTax() will return the calculated tax on item).

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 1PE: In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain...
icon
Related questions
Question

c++

Build a class Sale with private member variables
double itemCost; // Cost of the item
double taxRate; // Sales tax rate
and functionality mentioned below:
● Write a default constructor to set the member variable itemCost to 0 and
taxRate to 0. ● Write a parameterized constructor that accepts the parameter for each
member
Sale( double cost, double rate)

● Generate only accessors for itemCost and taxRate
● Write a function double getTax( ) to calculate tax i.e take a product of
itemCost and itemRate. ● Write a function double getTotal( ) to calculate the total price of item
i.e. take a sum of itemCost and getTax( ) (calling getTax() will return
the calculated tax on item).

Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr