14Tax Calculator

You don’t always need a complex control structure to solve simple problems. Sometimes a program requires an extra step in one case, but in all other cases there’s nothing to do.

Write a simple program to compute the tax on an order amount. The program should prompt for the order amount and the state. If the state is “WI,” then the order must be charged 5.5% tax. The program should display the subtotal, tax, and total for Wisconsin residents but display just the total for non-residents.

Example Output

 
What is the order amount? 10
 
What is the state? WI
 
The subtotal is $10.00.
 
The tax is $0.55.
 
The total is $10.55.

Or

 
What is the order amount? 10
 
What is the state? MN
 
The total is $10.00

Constraints

  • Implement this program ...

Get Exercises for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.