Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The original U.S. income tax of 1913 was quite simple. The tax was 1 percent on the first $50,000. 2 percent on the amount over
The original U.S. income tax of 1913 was quite simple. The tax was 1 percent on the first $50,000. 2 percent on the amount over $50,000 up to $75,000. 3 percent on the amount over $75,000 up to $100,000. 4 percent on the amount over $100,000 up to $250,000. 5 percent on the amount over $250,000 up to $500,000. 6 percent on the amount over $500,000.
You are asked to write a Java program to compute income tax using that simple system. Your program should read the taxpayer info from the keyboard. The following info must be supplied: full name (First Middle Last) and taxable income. Your program must deal with cases where the input values are not appropriate (Input validation MUST be in place), hint use the .hasNext0 method and alike. For instance, the program must check if the supplied income is a positive double value and exit if it is not One restriction on how the input is supplied is that there MUST be only one SINGLE space between any two successive names in the supplied full name. The program starts by output each part of the tax payer name in a separate line. To do that, your Page 1 of 4 program MUST use string manipulation methods in the String class such as substring0 and.charAt0 methods. You need to first identify the location of the first space then extract the first part of the string which will give you the first name. Then, you can extract the remaining part of the string after the first space and store it in a different string, this will give you the middle and last name. Repeat the above procedure to separate the middle and last names. Then, you can extract the remaining part of the string after the first space and store it in a different string, this will give you the middle and last name. Repeat the above dure to separate the middle and last names. After input validation and the display of the individual components of the tax payer in a separate line, the program will use an if-else-if construct to store an integer value (from 0 to 5) into a variable called range that represents the income range. For instance, range is assigned 0 for incomeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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