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.
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.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 6E
Related questions
Question
1
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 3 images
Knowledge Booster
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.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage