Design a Tips class that calculates the gratuity on a restaurant meal. Its only class member...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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. Demonstrate the class by creating a program that creates a single Tips object, then loops multiple times to allow the program user to retrieve the correct tip amount using various bill totals and desired tip rates. C++ 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 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. Demonstrate the class by creating a program that creates a single Tips object, then loops multiple times to allow the program user to retrieve the correct tip amount using various bill totals and desired tip rates. C++
Expert Answer:
Answer rating: 100% (QA)
Heres the C code for the Tips class and its demonstration C include using namespace std class Tips p... View the full answer
Related Book For
OCP Oracle Certified Professional Java SE 11 Developer Practice Tests Exam 1Z0 819 And Upgrade Exam
ISBN: 9781119696131
1st Edition
Authors: Scott Selikoff, Jeanne Boyarsky
Posted Date:
Students also viewed these programming questions
-
Referring to Table 25.2, explain why you might expect Co and Cu to not form miscible alloys. TABLE 25.2 The Crystal Structures of the 3d Elements Metal Sc Ti V Cr Mn Fe Co 8 235 Ni Cu Zn Natural...
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
A red laser ( lambda r = 6 3 3 nm ) is shone through a narrow slit located 2 m from a screen. When the light source is replaced by a blue laser ( b = 4 8 8 nm ) the position of the first minimum of...
-
Two recent graduates from business school (Mark Van and Sheila Epps) decided to set up an investment company to acquire home mortgages that are in default but that they hope to restructure in ways...
-
What does the concept of scaling have to do with the fact that living cells in a whale are about the same size as those in a mouse?
-
The price of a non-dividend paying stock is \($19\) and the price of a three-month European call option on the stock with a strike price of \($20\) is \($1.\) The risk-free rate is 4% per annum. What...
-
Faith Evans Corporation is a regional company which is an SEC registrant. The corporations securities are thinly traded on NASDAQ (National Association of Securities Dealers Quotes). Faith Evans...
-
A 'drought simply is a situation in which quantity of water demanded exceeds quantity of water supplied. Draw a demand-supply diagram for the water market portraying a drought. Does a drought have...
-
Daniel Company uses a periodic inventory system. Data for 2015: beginning merchandise inventory (December 31, 2014), 2,000 units at $38; purchases, 8,000 units at $40; expenses (excluding income...
-
The figure shows an assembly for testing the wooden specimen AB. The specimen has thickness (perpendicular to the figure) of 8 mm and width d = 10 mm, and the dimension h = 18 mm. If the wood fails...
-
Given the following extract of a trial balance for Potter Inc's trial balance, what is the total amount of "equity"? (what is the sum of all of the equity accounts listed)? Appropriated retained...
-
Flowers Inc. purchases an asset for $260,000 and will depreciate it down to zero using the straigth-line method. The life of the asset is 20 years. Flowers Inc. has a tax rate of 20%. If the asset is...
-
Evaluation of Ethical Principle : A . Definition - Explain this principle B . Importance - Discuss the significance of this principle to the workplace / organization C . Implementation - Discuss...
-
what is a collateralized loan? what is the advantage to the lender? to the borrower?
-
Describe in detail about the role of merchant banking in different countries.
-
Use your tax software to complete the following problems. If you are manually preparing the tax returns, you will need Form 1040, Schedule A, Schedule B, Schedule D, Schedule D worksheets, and Form...
-
In a nonmagnetic medium, E = 50 cos (10 9 t 8x) a y + 40 sin (10 9 t 8x) a z V/m find the dielectric constant r and the corresponding H.
-
What is the first line with a compiler error? A. Line R B. Line S C. Line T D. Line U E. None of the above class Mammal {} class Bat extends Mammal {} class Cat extends Mammal {} class Sat {} class...
-
Five of the following six methods always produce the same result whether they are executed on an ordered serial or parallel stream. Which one does not? A. findAny() B. findFirst() C. limit() D....
-
Which method reference can replace the lambda on the second line so the output is the same? A. a::contains(b) B. a::contains C. String::contains(b) D. String::contains E. The supplied code does not...
-
Given the four criteria necessary for a sale to be complete, which of the following is not one of those conditions? 1. Delivery has occurred or services rendered. 2. Cash has been collected. 3. The...
-
What is the difference between a business and a pure charity? Between a business and a governmental agency?
-
Will reform have a greater impact on insurers or providers?
Study smarter with the SolutionInn App