To solve this problem, you need to create two classes: MyAccounts.java and Salary.java. The MyAccounts class will contain the main program and the Salary class will be used to calculate the gross pay and net pay for each employee.
Here are the steps to implement the solution:
1. Create a new Java file called MyAccounts.java and open it in a text editor or an IDE.
2. Define the MyAccounts class with the following code:
```java
public class MyAccounts {
public static void main(String[] args) {
// Your implementation goes here
}
}
```
3. Now, create a new Java file called Salary.java and open it in a text editor or an IDE.
4. Define the Salary class with the following code:
```java
public class Salary {
public void calculatePay(String employeeName, String skillLevel, double hourlyRate, double hoursWorked) {
// Your implementation goes here
}
}
```
5. Inside the `calculatePay` method of the Salary class, calculate the gross pay by considering regular hours and overtime hours. Here's an example implementation:
```java
public void calculatePay(String employeeName, String skillLevel, double hourlyRate, double hoursWorked) {
double grossPay;
double overtimePay;
double netPay;
if (hoursWorked <= 40) {
grossPay = hoursWorked * hourlyRate;
overtimePay = 0;
} else {
grossPay = 40 * hourlyRate;
overtimePay = (hoursWorked - 40) * hourlyRate * 1.5;
if (hoursWorked > 50) {
overtimePay = 10 * hourlyRate * 1.5;
}
}
netPay = grossPay - calculateTax(grossPay);
printOutput(employeeName, hoursWorked, hourlyRate, grossPay, netPay);
}
```
6. Notice that the `calculatePay` method also calls two additional helper methods: `calculateTax` and `printOutput`. Implement these methods as follows:
```java
private double calculateTax(double grossPay) {
// Calculate tax based on grossPay
// Your implementation goes here
return taxAmount;
}
private void printOutput(String employeeName, double hoursWorked, double hourlyRate, double grossPay, double netPay) {
// Print the required outputs
System.out.println("Employee Name: " + employeeName);
System.out.println("Total Hours Worked: " + hoursWorked);
System.out.println("Rate Per Hour: " + hourlyRate);
System.out.println("Gross Pay: " + grossPay);
System.out.println("Net Pay: " + netPay);
}
```
7. In the main method of MyAccounts class, create an instance of the Salary class and call the `calculatePay` method with appropriate inputs. Here's an example:
```java
public static void main(String[] args) {
Salary salary = new Salary();
salary.calculatePay("John Doe", "Level 1", 10.0, 45.0);
}
```
8. Compile and run the MyAccounts class. You should see the required outputs printed in the console.
Note: The implementation provided here is just an example. You might need to modify it based on your specific requirements or add additional functionality as needed.