Computer Science, asked by robiterang3020, 9 months ago

Write a Java program with the following descriptions:
 tax(String name, int annualincome) - which displays the name of the employee and the income tax as per the given tariff:
 main() method to invoke tax() method with appropriate values.
Annual Income
Income Tax
Up to ₹2,50,000
No tax
₹2,50,001 to ₹5,00,000
10% of the income exceeding ₹2,50,000
Annual Income
Income Tax
₹5,00,001 to ₹10,00,000
₹30,000 + 20% of the amount exceeding ₹5,00,000
₹10,00,001 and above
₹50,000 + 30% of the amount exceeding ₹10,00,000

Answers

Answered by majirouvik
6

Answer:

public class Test {

public static void main(String[] args)

{

Test ob=new Test();

ob.tax("Robiterang3020",500500);

}//end of main()

public void tax(String name, int annualincome)

{

System.out.println("Name:"+name);//printing name

if(annualincome<=250000)

{

System.out.print("Your tax=0% and your income tax=Rs0");

} else if(annualincome>250000&& annualincome<=500000)

{

System.out.print("Your tax=10% and your income tax=Rs"+(10/100.0*annualincome));

}else if(annualincome>500000&& annualincome<=1000000)

{

System.out.print("Your tax=Rs30000+20% of the amount exceeding 500000 and your income tax="+(50000+(20/100.0*(annualincome-500000))));

}else if(annualincome>1000000)

{

System.out.print("Your tax=Rs50000+30% of the amount exceeding 1000000 and your income tax="+(30000+(30/100.0*(annualincome-1000000))));

}

}//end of tax()

}//end of class

Pretty big code but I guess this might help you...just copy it out from here and paste it in your java compiler,for explanation see the comments and follow the math carefully...

From Rouvik Maji

Similar questions