Advertisement
benedict8538

Problem 4

Aug 3rd, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. import java.io.*;
  2. public class Problem4{
  3.     public static void main(String[]args){
  4.         BufferedReader ben = new BufferedReader(new InputStreamReader(System.in));
  5.        
  6.         double GrossIncome = 0;
  7.         double deduction = 0;
  8.         double NetIncome = 0;
  9.         double tax = 0;
  10.        
  11.        
  12.         try{
  13.                 System.out.print("Input gross income: ");
  14.                 GrossIncome = Integer.parseInt(ben.readLine());
  15.                 System.out.print("Input total deduction: ");
  16.                 deduction = Integer.parseInt(ben.readLine());
  17.                
  18.            
  19.                 if(GrossIncome>100000){
  20.                     tax = GrossIncome*.2;
  21.                     NetIncome = GrossIncome-tax-deduction;
  22.                     System.out.println("Net Income is: "+NetIncome);}
  23.                 else if(50000<GrossIncome&&GrossIncome<100000){
  24.                     tax = GrossIncome*.15;
  25.                     NetIncome = GrossIncome-tax-deduction;
  26.                     System.out.println("Net Income is: "+NetIncome);}
  27.                 else{
  28.                     tax = GrossIncome*.1;
  29.                     NetIncome = GrossIncome-tax-deduction;
  30.                     System.out.println("Net Income is "+NetIncome);}
  31.                
  32.             }catch(IOException e){
  33.                 System.out.println("Error");}
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement