Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a Tips class that calculates the gratuity on a restaurant meal. Its only class member variable, taxRate, should be set by a one-parameter non-default

Design a Tips class that calculates the gratuity on a restaurant meal. Its only class member variable, taxRate, should be set by a one-parameter non-default constructor to whatever rate is passed to it when a Tips object is created. If no argument is passed, a default tax rate of .065 should be used. The class should have just one public function, computeTip. This function needs to accept two arguments, the total bill amount and the tip rate. It should use this information to compute what the cost of the meal was before the tax was added. It should then apply the tip rate to just the meal cost portion of the bill to compute and return the tip amount.

Original Bill Amount=Bill Amount / (1+tax rate)

Demonstrate the class by creating a program that creates a one Tips object created with the non-default constructor and one created with the default constructor. Then, call the computeTip member function with a specified bill amount and tip rate to print how much you should tip for your food using both objects. Remember, all data members should be private!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. What are your challenges in the creative process?

Answered: 1 week ago