In: Computer Science
In this SLP assignment, we will get more practice with the concepts we have learned.
Read the following requirements, first write pseudo code based on your understanding, and then develop a Java application program based on your pseudo code.
Income tax bracket percentage:
0–$8,500: 10%
$8,500–$34,500: 15%
$34,500–$83,600: 25%
$83,600–$174,400: 28%
$174,400–$379,150: 33%
$379,150 and above: 35%
Hint: use the following as reference to write if and else
statement.
can someone help me complete this pleasee
Algorithm:
Code:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class TaxCalculator {
public static void main(String[] args){
try{
BufferedReader
br = new BufferedReader(new InputStreamReader(System.in));
/*
* getting user
taxable income
*/
System.out.println("Enter your taxable income: ");
double income =
Integer.parseInt(br.readLine());
/*
* initialiazing
tax amount to 0
*/
double tax =
0.0;
/*
* calculating
tax for various income groups
*/
if(income > 0
&& income <= 8500){
tax = income * 10 / 100;
}
else if(income
> 8500 && income <= 34500){
tax = income * 15 / 100;
}
else if(income
> 34500 && income <= 83600){
tax = income * 25 / 100;
}
else if(income
> 83600 && income <= 174400){
tax = income * 28 / 100;
}
else if(income
> 174400 && income <= 379150){
tax = income * 33 / 100;
}
else if(income
> 379150){
tax = income * 35 / 100;
}
/*
* displaying tax
amount
*/
System.out.println("Your tax amount: " + tax);
}
catch(Exception e){
e.printStackTrace();
}
}
}
code screenshot:
Output: