Page 461 - CA_Blue( J )_Class10
P. 461
9 System.out.println("Enter name and monthly salary");
10 n=sc.next();
11 ms=sc.nextDouble();
12 }
13 void cal() // Method to calculate Income Tax
14 {
15 double as;
16 as=ms*12;
17 if(as>=175000)
18 it=0.05*as;
19 else
20 it=0.0;
21 }
22 //Method to display Name, Monthly Salary, Annual Salary, and Income Tax.
23 void display() // Method to display Name, Monthly Salary, Annual Salary
24 {
25 System.out.println("Name "+n);
26 System.out.println("Monthly Salary "+ms);
27 System.out.println("Annual Salary " + (ms*12));
28 System.out.println("Income Tax "+it);
29 }
30 public static void main()
31 {
32 Salary ob= new Salary(); // Creation of object Ob of class Salary
33 ob.accept(); // Invocation of Functions
34 ob.cal();
35 ob.display();
36 } //Close of main()
37 } // Close of class
Output
Enter name and monthly salary
Amar
34500
Name Amar
Monthly Salary 34500.0
Annual Salary 414000.0
Income Tax 20700.0
459
Internal Assessment 459

