1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Reptile [31]
3 years ago
12

Create a program that calculates three options for an appropriate tip to leave after a meal at a restaurant.

Computers and Technology
1 answer:
max2010maxim [7]3 years ago
7 0

Complete Question:

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

Answer:

Answered in Python

print("Tip Calculator")

tryagain = "y"

while tryagain == "y" or tryagain == "Y":

    amount = float(input("Cost of Meal: "))

    for tip_percent in range(15,26,5):

         print(str(tip_percent)+"%")

         print("Tip Amount: "+str(round(tip_percent * amount/100,2)))

         print("Total Amount: "+str(round(amount + (tip_percent * amount/100),2)))

    tryagain = input("Continue?y/n: ")

print("Bye!")

Explanation:

This prints the name of the calculator

print("Tip Calculator")

This initializes tryagain to yes

tryagain = "y"

While tryagain is yes, the following loop is repeated

while tryagain == "y" or tryagain == "Y":

This prompts user for amount of meal

    amount = float(input("Cost of Meal: "))

This gets the tip_percent which is 15%, 20% and 25% respectively

    for tip_percent in range(15,26,5):

This prints the tip_percent

         print(str(tip_percent)+"%")

This calculates and prints the tip amount rounded to 2 decimal places

         print("Tip Amount: "+str(round(tip_percent * amount/100,2)))

This calculates and prints the total amount rounded to 2 decimal places

         print("Total Amount: "+str(round(amount + (tip_percent * amount/100),2)))

This prompts user to continue or not

    tryagain = input("Continue?y/n: ")

The program ends here

print("Bye!")

You might be interested in
Last semester, Henri bought his textbooks over the Internet and saved a considerable amount of money. Classes start in a few day
castortr0y [4]

Answer:

limited problem solving

Explanation:

Henri will probably use a limited problem-solving process, we reach this conclusion due to two factors:

  1. The time he has to take the decision is short, therefore he can calmly evaluate his options
  2. His past positive experience in buying books online will influence his decision

I hope you find this information useful and interesting! Good luck!

3 0
3 years ago
Read 2 more answers
Chris needs to modify the default bullets that are used in a nonnumbered list in Word.
laiz [17]

Answer:

he should select the arrow next to the bullet list

Explanation:

6 0
3 years ago
Read 2 more answers
Website hosting servers have their own unique IP address, what does this address consist of?
Alchen [17]
A. Numbers and letters
4 0
3 years ago
1. Which of the following is a result of a successful negotiation?
Alik [6]
Maybe a Win win outcome
7 0
4 years ago
Read 2 more answers
Fill in the code in the underlined location to display the mouse point location when the mouse is pressed in the pane. pane.setO
Svet_ta [14]

Answer:

The correct option is  pane.setOnMouseClicked((e) -> System.out.println(e.getX() + ", " + e.getY()));

Explanation:

As the complete question is not provided, the complete question is attached herewith.

In order to handle the underlined location the way is to get the position using the MouseClicked event which will be activated when the mouse is clicked and then the values of X and Y position will be printed.

pane.setOnMouseClicked((e) -> System.out.println(e.getX() + ", " + e.getY()));

The other options are not correct as the handle used in them is not defined for this purpose.

6 0
4 years ago
Other questions:
  • You are asked to write an app to keep track of a relatively small music library. The app should load song information from a dat
    14·1 answer
  • Explain how inflation flattens the universe
    6·2 answers
  • Adding software to a digital device, or adding hardware components to a digital device is called _____ .
    13·1 answer
  • This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balance
    7·1 answer
  • Which category of software would programming languages fall into?
    8·2 answers
  • Describe the five steps of the process of assessing personal strengths and weaknesses
    15·1 answer
  • ________ is a publicly accessible website that allows users to add and edit interlinked web pages and make contributions from th
    8·2 answers
  • When your purchases are swiped over the bar-code reader at the point-of-sale terminals at Wal-Mart, a _____ records the data.
    8·1 answer
  • What is 4x+2x(-3-3) thanku
    11·2 answers
  • Does anyone know how to do Python Essentials 5.7.1.6 because i am completely lost
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!