subject

Write a Python program to calculate tax and tip. Ask the user for a check amount, and calculate the tax and tip, providing tip amounts for stingy, regular, and generous customers. Use the following steps:

Prompt the user for a check amount and store it in a variable called check_amount_str.
Convert check_amount_str to a floating point number and store it in a variable called check_amount.
Calculate tax amount (7%) and three tip amounts (10%, 15%, and 20%), storing each result in a separate variable.
Calculate total for regular customers including 7% tax and 15% tip. Print the results to the console like in the example below, including the base cost of the meal, tax, three tip levels, and total for regular customers.

The expected output from your program should look like the following:
Please enter check amount: $ 20
Base cost: $ 20.00
Tax (7 %): $ 1.40
Tip for stingy customers (10 %): $ 2.00
Tip for regular customers (15 %): $ 3.00
Tip for generous customers (20 %): $ 4.00
Total with tax and tip for regular customers: $ 24.40

Note: that it’s okay for now if you have more decimals, e. g. your total might look like $ 24.40000001. We will learn how to format your output later.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:20, Korkot7633
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
image
Computers and Technology, 23.06.2019 04:31, Remba
Q14 what is most important for you to choose before you build a network? a. private network b. nos c. network media d. network protocol e. directory service
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, carolelai08
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
image
Computers and Technology, 23.06.2019 20:30, lucywood2024
What is the biggest difference between section breaks and regular page breaks
Answers: 1
You know the right answer?
Write a Python program to calculate tax and tip. Ask the user for a check amount, and calculate the...

Questions in other subjects: