Answer:
bill = float(input("Enter the bill amount: "))
rating = int(input("Choose a rating: 1 = Totally satisfied, 2 = Satisfied, 3 = Dissatisfied.: "))
if rating is 1:
tip = bill * 0.2
elif rating is 2:
tip = bill * 0.15
elif rating is 3:
tip = bill * 0.1
print("The rating is: " + str(rating))
print("The tip is: $%.2f" % (tip))
Explanation:
*The code is in Python
- Ask the user for the bill and rating
- Depending on the rating, calculate the tip using if else statement i.e. If the rating is chosen as 1, calculate the tip by taking 20 percent of the bill.
- Print the rating and the tip