Computer Science, asked by arkamitra01, 1 month ago

bluej problem if else if

Attachments:

Answers

Answered by bhattkashish1234
1

Answer:

import java.util.*;

public class Tax//starting of class

{

   public static void main()//starting of main method

   {

       Scanner sc = new Scanner(System.in);

       System.out.println("Enter the annual income");

       int ai=sc.nextInt();//ai used to store annuak income of the user

       double tax=0;//tax used to calculate the tax to be paid

       if(ai<=100000)

       {

          tax=0;

       }

       else if(ai>100000&&ai<=250000)

       {

           tax=(ai*10)/100;

       }

       else if(ai>250000&&ai<=500000)

       {

           tax=(ai*20)/100;

       }

       else  

       {

           tax=(ai+30)/100;

       }

       double amt=ai-tax;//amt is used to calculate the remaining amount

       System.out.println("The tax to be paid is "+tax);

       System.out.println("The remaining amount is "+amt);

   }//end of method

}//end of class

Explanation:

Similar questions