Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Programming: Create a program that calculates three options for an appropriate tip to leave after a meal at a restaurant and repeats if the

Python Programming: Create a program that calculates three options for an appropriate tip to leave after a meal at a restaurant and repeats if the user enters "y" or "Y" to continue.

  • Print the name of the application "Tip Calculator"
  • Get input from the user for "Cost of meal: "
  • Calculate and display the "Tip Amount" and "Total Amount" at a tip_percent of 15%, 20%, and 25%.
    • Use a FOR loop to iterate through the tip_percent
    • The formula for calculating the tip amount is: tip = cost of meal * (tip percent / 100)
    • The program should accept decimal entries like 52.31. Assume the user will enter valid data.
    • The program should round the results to a maximum of two decimal places
  • At the "Continue? (y/n)" prompt, the program should continue only if the user enters y or Y to continue.
  • Print "Bye!" or a salutation at the end of the program

Be sure to test your work so that it runs in a manner shown below.

The data I entered is in bold maroon... but your program should run properly for any valid value entered by a user.

Tip Calculator

Cost of meal: 52.31

15% Tip amount: 7.85 Total amount: 60.16

20% Tip amount: 10.46 Total amount: 62.77

25% Tip amount: 13.08 Total amount: 65.39

Continue (y/n)?: y

Cost of meal: 23.60

15% Tip amount: 3.54 Total amount: 27.14

20% Tip amount: 4.72 Total amount: 28.32

25% Tip amount: 5.9 Total amount: 29.5

Continue (y/n)?: n

Bye!

Use whitespace and skip lines to make the output match the example and # comments.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions