Computer Science, asked by sinhaankitalko, 1 year ago

define a class Salary as described below:
Data Members: Name, Address, Phone, Subject Specialization, Monthly Salary, Income tax

Member methods:
1) To accept the details of a teacher including the monthly salary
2) To display the details of a teacher
3)To compute the annual income tax as 5% of the annual salary above175000
write a main method to create object of a class and call the above member method



plzz sove it fast

Answers

Answered by Tejaa1
75
Here is the solution to your question. Hope it helps.
Attachments:
Answered by Anonymous
34

The program is as follows:

class Salary

{

string Name ;

string Address ;

int Phone ;

string SubjectSpecialization ;

float MonthlySalary ;

float IncomeTax ;

public void details (string a, string b, int N, string c, float d)

{

Name = a;

Address = b;

Phone = N;

SubjectSpecialization = c;

MonthlySalary  = d;

}

public void show ( )

{

System.out.println("Name" + Name);

System.out.println("Address" + Address);

System.out.println("Phone" + Phone);

System.out.println("Subject Specialization" + SubjectSpecialization );

System.out.println("Monthly Salary" + MonthlySalary);

}

public void Income_Tax ( )

{

float IncomeTax;

float AnnualSalary = 12 * MonthlySalary;

if (Annual Salary > 175000)

IncomeTax = (5/100)*(Annual Salary - 175000);

System . out . println( IncomeTax );

}

public static void main (String ar [ ])

{

Salary p = new Salary( );

p. details = ( " XYZ ", "Coimbatore", 9735736374 , "PHYSIOLOGY" , 32000.0);

p. show( )

p. Income_Tax( )

}

}

Similar questions