Question
Create an IPO and algorithm for the following code: import java.util.Scanner;//import Scanner public class IncomeTax { //start class public static void main(String[] args) { //start
Create an IPO and algorithm for the following code:
import java.util.Scanner;//import Scanner public class IncomeTax { //start class public static void main(String[] args) { //start main method Scanner keyboard = new Scanner(System.in);//red in the user input double netIncome, tax, fivePercentTax, tenPercentTax; System.out.println("Enter net income. "//prompt user to enter icome + "Do not include a dollar sign or any commas."); netIncome = keyboard.nextDouble( ); if (netIncome <= 15000) tax = 0;//if the income was less than 15000 then there is no tax else if ((netIncome > 15000) && (netIncome <= 30000)) tax = (0.05*(netIncome - 15000)); //net income minus 15000 times .05 will equal tax else //netIncome > $30,000 { //fivePercentTax = 5% of income from $15,000 to $30,000. fivePercentTax = 0.05*15000; //tenPercentTax = 10% of income over $30,000. tenPercentTax = 0.10*(netIncome - 30000); tax = (fivePercentTax + tenPercentTax); } System.out.printf("Tax due = $%.2f", tax); }//end maind method } //end class
Step 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