Question
Q3: A very popular application on cell phones is a tip amount calculator. Write a program that takes as input the total amount of a
Q3:
A very popular application on cell phones is a tip amount calculator. Write a
program that takes as input the total amount of a restaurant bill. Then use a wh
ile loop to generate a chart of tip
amounts for each percentage from 10% to 25%. Show the amount of the tip
along with the total bill with the tip
amount
included
. Below is a sample set of input and output for your program:
Sample input and output:
Enter
the total restaurant charge: $19.27
------Tipping Chart-----
Percent Tip Total
10% $1.93 $21.20
11% $2.12 $21.39
12% $2.31 $21.58
13% $2.51 $21.78
14% $2.70 $21.97
15% $2.89 $22.16
16% $3.08 $22.35
17% $3.28 $22.55
18% $3.47 $22.74
19% $3.66 $22.93
20% $3.85 $23.12
21% $4.05 $23.32
22% $4.24 $23.51
23% $4.43 $23.70
24% $4.62 $23.89
25% $4.82 $24.09
Note:
To print an % symbol, use %% in the printf format string. The $ is part of the prompt, and not
entered by the user.
Caution:
Float data types are converted to binary when stored, and slight
inaccuracies can often result because of this conversion. Never us
e a float in a comparison condition of
a while statement!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started