Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part II: Restaurant Tipping (4 points) After many years, you have developed a system for determining exactly how much to tip when eating out at

image text in transcribed
image text in transcribed
Part II: Restaurant Tipping (4 points) After many years, you have developed a system for determining exactly how much to tip when eating out at a restaurant: . If the final bill is $30.00 or less, you will leave a tip of exactly $5.00 (regardless of the quality of service) . If the final bill was greater than $30.00 and the service was "good" (according to some criteria that we won't bother describing here), you will leave a tip of 25% of the final bill . Otherwise (meaning that the final bill was over S30.00 but the service was"bad"), you will leave a tip equal to 15% of the final bill. The "problem2py" file contains a Python function named tip amount that can help you decide how much to leave as a tip. It takes two arguments, in the following order: the amount of the final bill (a positive floating-point number) and a boolean value categorizing the quality of the servie (True indicates "good" service and False indicates "bad" service). The function returns a floating-point number corresponding to the amount you will leave as a tip. For example, tip amount (12.56, False) returns 5.0, representing S5 (even though the service was bad, your system still requires you to leave a $5 tip). tip-amount (48.93, True) returns 12.2325, representing a 25% tip (for this problem, don't worry about rounding the tip amounts to two decimal places), Examples: Function Call Return Value 5.0 5.0 tip-amount (23.37, t.ip amount. (81.15, True tip amount. (63.59, False)9.5385 True) tip anount (23.3. Falsel Lip amount (63.59, True) 15.8975

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

Step: 3

blur-text-image

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions