Problem 2 (Calculations) Write a program called p2.py that implements a tip calculator. Your program should ask the user for the bill amount (float) and the percentage of the tip (float). You can assume that the user will always enter valid input. Your program then should output (i) the dollar amount of the tip and (ii) the final bill in three different formats. See sample outputs below. User input is highlighted for emphasis. Sample Output - 1 Enter the bill amount: 27.95 Enter tip percentage: 17 A 17.0% tip on $27.95 equals $4.7515 The total bill is: 32.701499999999996 The total bill is: $32.7 The total bill is: $32.70

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section: Chapter Questions
Problem 8PP: (Modify) a. Modify the program you wrote for Exercise 7 to provide the mass of a person as an...
icon
Related questions
Question
Problem 2 (Calculations)
Write a program called p2.py that implements a tip calculator.
Your program should ask the user for the bill amount (float) and the percentage of the tip
(float). You can assume that the user will always enter valid input. Your program then
should output (i) the dollar amount of the tip and (ii) the final bill in three different formats.
See sample outputs below. User input is highlighted for emphasis.
Sample Output - 1
Enter the bill amount: 27.95
Enter tip percentage: 17
A 17.0% tip on $27.95 equals $4.7515
The total bill is: 32.701499999999996
The total bill is: $32.7
The total bill is: $32.70
Sample Output - 2
Enter the bill amount: 56.5
Enter tip percentage: 15
A 15.0% tip on $56.5 equals $8.475
The total bill is: 64.975
The total bill is: $64.97
The total bill is: $64.97
Page 2 of 4
Transcribed Image Text:Problem 2 (Calculations) Write a program called p2.py that implements a tip calculator. Your program should ask the user for the bill amount (float) and the percentage of the tip (float). You can assume that the user will always enter valid input. Your program then should output (i) the dollar amount of the tip and (ii) the final bill in three different formats. See sample outputs below. User input is highlighted for emphasis. Sample Output - 1 Enter the bill amount: 27.95 Enter tip percentage: 17 A 17.0% tip on $27.95 equals $4.7515 The total bill is: 32.701499999999996 The total bill is: $32.7 The total bill is: $32.70 Sample Output - 2 Enter the bill amount: 56.5 Enter tip percentage: 15 A 15.0% tip on $56.5 equals $8.475 The total bill is: 64.975 The total bill is: $64.97 The total bill is: $64.97 Page 2 of 4
Expert Solution
steps

Step by step

Solved in 6 steps with 4 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr