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 .085 should be used. You may use a default constructor for the default value. taxRate should be Private.
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 the total bill amount, along with the value stored in the taxRate member variable to compute the cost of the meal 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 amounts.
Demonstrate the class by creating a program that creates a single Tips object, and then loops to let the user retrieve the correct tip amount using various bill totals and desired tip rates.
Validation: The tax rate entered by the user should be validated to ensure that it is greater than or equal to zero.
Sample Output:
This program will compute a restaurant tip based on a total bill amount and the % the patron wishes to tip the server.
Tax % for this location: -3
Tax % cannot be less than 0. Please re-enter tax %: 6
************* Tip Helper *************
Enter total bill amount: 25.00
Enter desired tip % 20
The tip should be $ 4.72
Compute another tip (y/n)? y
************* Tip Helper *************
Enter total bill amount: 10.43
Enter desired tip % 15
The tip should be $ 1.48
Compute another tip (y/n)? n