1. Engineering
2. Computer Science
3. follow the below instructions and develop your program in this...

# Question: follow the below instructions and develop your program in this...

###### Question details

Follow the below instructions and develop your program. In this assignment, there is no need for getting input from the user. You can just use the salary1, isMarried1, salary2, and isMarried2 variables provided to you.

• 1) Calculate and print the tax rate for the two employees:
• Create two objects of type TRCalc.
• Set the isMarried and salary attributes of the two objects using setMarried (note the small difference in the name) and setSalary accessor methods.
• Call the calcTr() method of the two objects. This method receives no parameter and returns nothing. It only updates the value of the taxRate attribute of the object.
• Use the getTaxRate mutator methods of the two object and print the tax rate of the two employees to the console as below:
Tax rate for Employee 1 is: [calculated value for the tax rate of employee 1]
Tax rate for Employee 2 is: [calculated value for the tax rate of employee 2]

• 2) Calculate and print the gross pay for the two employees:
• Create two objects of type Employee.
• Set the salary attribute of the two objects using the setSalary accessor methods.
• Call the calculateGrossPay() method of the two objects. This method receives no parameter and returns nothing. It only updates the value of the grossPay attribute of the object.
• Use the getGrossPay mutator methods of the two object and print the gross pay of the two employees to the console as below:
Gross pay for Employee 1 is: [calculated value for the gross pay of employee 1]
Gross pay for Employee 2 is: [calculated value for the gross pay of employee 2]

• 3) Calculate and print the gross pay of the two employees as below:
• net pay = ( gross pay * ( 1 - (tax rate / 100) )
Net pay for Employee 1 is: [calculated value for the net pay of employee 1]
Net pay for Employee 2 is: [calculated value for the net pay of employee 2]

class TRCalc{
private boolean married;
private double salary;
private double taxRate;
void setMarried(boolean isMarried) {
married = isMarried;
}
void setSalary(double inputSalary) {
salary = inputSalary;
}
double getTaxRate() {
return taxRate;
}
void calcTR() {
if(married) {
if(salary < 84000) taxRate = 22;
else if(salary < 160000) taxRate = 24;
else if(salary < 204000) taxRate = 32;
else taxRate = 35;
} else {
if(salary < 168000) taxRate = 22;
else if(salary < 321000) taxRate = 24;
else if(salary < 408000) taxRate = 32;
else taxRate = 35;
}
}

}

class Employee{
private double salary;
private double grossPay;
void setSalary(double salary) {
this.salary = salary;
}
double getGrossPay() {
return grossPay;
}
void calculateGrossPay() {
grossPay = salary/12;
}

}

public class Main {

public static void main(String[] args) {

// Employee 1's info
double salary1 = 100000;
boolean isMarried1 = true;

// Employee 2's info
double salary2 = 400000;
boolean isMarried2 = false;

// Do not change anything abvoe this line.
// Write your code below

// Do not change anything below this line.
}
}

###### Solution by an expert tutor 