Question
Write a complete Java program called ''IncomeTax'' (without the quotation marks) that prompts a user for his or her marital status (single or married) and
Write a complete Java program called ''IncomeTax'' (without the quotation marks) that prompts a user for his or her marital status (single or married) and annual income (a double value), and then uses nested if statements to compute that person's tax, based on the simplified tax-rate table below.
Income | Marital Status - Single | Marital Status - Married |
---|---|---|
<= $30,000 | 25% | 20% |
> $30,000 | 15% | 12% |
Your program must be written so that it
uses nested if statements
prints the dollar sign, and prints the numbers to two decimal places
uses constants for the tax rates
has just one print statement for the output (you'll also need print statements for the prompts)
has prompts that tell the user exactly how to input the requested information.
prints as output: "Based on a marital status of X and a tax rate of Y, your tax is Z", where X is the marital status the user entered, Y is the appropriate tax rate for the entered income and marital status, and Z is the amount of tax printed to two decimal places.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started