Question: Write a Java program that will request from the user his/her marital status as a character or a string (watch carefully the sample run). Remember

Write a Java program that will request from the user his/her marital status as a character or a string (watch carefully the sample run). Remember that a character cannot be read singly, JOptionPane.showInputDialog() returns a String and there is no nextChar() method of the Scanner class. Your program will request from the user his/her salary. Use the tax rate chart below to compute the tax on the salary. Display the marital status (the word), base salary and the tax in a JOptionPane NOTE - display base salary and tax due formatted with commas, dollar signs and 2 decimal places. Use DecimalFormat. This program will be functionally decomposed into at least the following methods: an input method to return the marital status (your choice whether String or character return) an input method to return the salary (this is a monetary value, use a double) a calculation method to determine tax bracket, calculate the tax and return the tax a method to display all of the data as shown below in the sample run Watch the variable/identifier naming --- variables/identifiers should be descriptive

Federal Tax Rate Schedule (Horstmann, 2015)

Single and

The tax is

Of the amount over

Income <= $32,000

0%

$0

Income > $32,000

$3,200 + 25%

$32,000

Married and

The tax is

Of the amount over

Income <= $64,000

10%

$0

Income > $64,000

$6,400 + 25%

$64,000

A sample run of this program might look like this (user input is in bold): Enter marital status: S

Enter salary : 38000

Sample output --- yours may be in a JOptionPane

Given your single marital status and your base salary of $38,000.00, your tax is : $4,700.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!