Write a Receipt class that outputs a meal receipt. The class constructor expects a double meal_price and tip_rate, it has private variables tax (const variable), gratuity, and price, and public functions calculate_tax(returns double), calculate_gratuity(returns double), and display_receipt(double). The tax rate is 8%. Implementation In header file, write the class interface and class function protypes. In cpp file, write the class function code. Test Cases Use the following test data to test the class. Expected Tax .80 1.60 2.40 Meal Amount 10 20 30 Gratuity Rate 20% 15% 10% Expected Gratuity 2 3 Main Program Flow The main program will prompt the user for a meal amount and use the Receipt class to display the receipt to screen, and will continue to run until the user opts out. Validate for correct input.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.2: Basic Class Functions
Problem 11E
icon
Related questions
Question

1

QUESTION 1
Write a Receipt class that outputs a meal receipt. The class constructor expects a double meal_price and tip_rate, it has private variables tax (const variable), gratuity, and price, and public functions calculate_tax(returns double), calculate_gratuity(returns
double), and display_receipt(double). The tax rate is 8%.
Implementation
In header file, write the class interface and class function protypes.
In cpp file, write the class function code.
Test Cases
Use the following test data to test the class.
Expected Tax
.80
1.60
2.40
Meal Amount
10
20
30
Gratuity Rate
20%
15%
10%
Expected Gratuity
2
3
3
Main Program Flow
The main program will prompt the user for a meal amount and use the Receipt class to display the receipt to screen, and will continue to run until the user opts out. Validate for correct input.
40 DOInre
swer
Transcribed Image Text:QUESTION 1 Write a Receipt class that outputs a meal receipt. The class constructor expects a double meal_price and tip_rate, it has private variables tax (const variable), gratuity, and price, and public functions calculate_tax(returns double), calculate_gratuity(returns double), and display_receipt(double). The tax rate is 8%. Implementation In header file, write the class interface and class function protypes. In cpp file, write the class function code. Test Cases Use the following test data to test the class. Expected Tax .80 1.60 2.40 Meal Amount 10 20 30 Gratuity Rate 20% 15% 10% Expected Gratuity 2 3 3 Main Program Flow The main program will prompt the user for a meal amount and use the Receipt class to display the receipt to screen, and will continue to run until the user opts out. Validate for correct input. 40 DOInre swer
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,