Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Is there anything wrong with my code? i keep getting the 'could not convert string to float' value error. Write a program that computes the

Is there anything wrong with my code? i keep getting the 'could not convert string to float' value error.

Write a program that computes the tax and the tip on a restaurant bill. The program should ask the user to enter the charge of the meal. The tax should be 6.75 percentage of the meal charge. The tip should be 20 percent of the total after adding the tax. Display the meal charge, tax amount, tip amount, and the total bill on the screen. Please make sure you add the appropriate comments through out the program. Please submit your .py file.

meal_charge = float(input("Enter the charge for the meal: ")) tax_amount = meal_charge * 0.0675 total_with_tax = meal_charge + tax_amount

print("Meal charge: $%.2f" % meal_charge) print("Tax amount: $%.2f" % tax_amount) print("Total with tax: $%.2f" % total_with_tax)

tip_amount = total_with_tax * 0.20 total_with_tip = total_with_tax + tip_amount

print("Tip amount: $%.2f" % tip_amount) print("Total to be paid with tip: $%.2f" % total_with_tip)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions