NOTE: Is learning python programming Book \"Starting Out With Python 3rd Edition
ID: 3884880 • Letter: N
Question
NOTE:
Is learning python programming
Book "Starting Out With Python 3rd Edition by Gaddis
Imagine that you and a number of friends go to a luxury restaurant, and when you ask for the bill you want to split the amount and the tip (15 percent) between all. Write pseudocode (NOT a program!) for calculating the amount of money that everyone has to pay. Your program should print the amount of the bill, the tip, the total cost, and the amount each person has to pay. It should also print how much of what each person pays is for the bill and for the tip.
You should list the input and output of the program. Again, DO NOT write code, just the algorithm in pseudocode.
Explanation / Answer
#This is the input of the program
bill <- input from user
# Calculating tip which is 15% of bill
tip <- 0.15*bill
# Total cost = bill + tip
total_cost <- bill + tip
# Dividing the total cost between each person
each_amount <- total_cost/no_of_persons
# Output the bill, tip, total cost and each person's pay
print bill
print tip
print total_cost
print each_amount
<- storing the value in the respective variable
**Comment for any further queries
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.