logo CodeStepByStep logo


The following console program always computes the same output. Modify it to be an interactive program that prompts the user to enter the meal cost as shown and computes the rest of the values based on that meal cost. Here are two example logs of execution:

What was the meal cost? $50
Subtotal: 50
Tax: 4.0
Tip: 7.5
Total: 61.5 
What was the meal cost? $125
Subtotal: 125
Tax: 10.0
Tip: 18.75
Total: 153.75
Complete program: Write an entire program that you could put into a file and run outside of CodeStepByStep.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.