Missing details:
The formula for calculating the tip amount is:
tip = cost of meal * (tip percent / 100)
- The program should accept decimal entries like 52.31 and 15.5.
- Assume the user will enter valid data.
- The program should round the results to a maximum of two decimal places.
Answer:
In Python:
print("Tip Calculator")
cost_meal = float(input("Enter Cost of Meal: "))
tip_percent = float(input("Enter Tip Percent: "))
tip_amount = cost_meal * tip_percent / 100
total_amount = tip_amount + cost_meal
print("Tip amount: "+str(round(tip_amount,2)))
print("Total amount: "+str(round(total_amount,2)))
Explanation:
This line prints the string "Tip "Calculator"
print("Tip Calculator")
This lime prompts user for cost of meal
cost_meal = float(input("Enter Cost of Meal: "))
This lime prompts user for tip percemtage
tip_percent = float(input("Enter Tip Percent: "))
This line calculates the tip amount
tip_amount = cost_meal * tip_percent / 100
This line calculates the total amount
total_amount = tip_amount + cost_meal
This line prints the tip amount
print("Tip amount: "+str(round(tip_amount,2)))
This line prints the total amount
print("Total amount: "+str(round(total_amount,2)))
Follow these steps to complete the solution
- <em>Copy the code in the answer section.</em>
- <em>Save as .py</em>
- <em>Run the program</em>
- <em>Save the screenshots of the program result in a word document</em>