Question: I created my code. But I keep getting an error because of this message on the screen. How do I define EmployeeTest as its own
I created my code. But I keep getting an error because of this message on the screen. How do I define EmployeeTest as its own file so the program can run ? ( I ALSO INCLUDED THE CODE )

public class Employee {
private String first;
private String last;
private double salary;
public Employee(String first, String last, double salary) {
this.first = first;
this.last = last;
if(salary > 0) {
this.salary = salary;
}
else {
salary = 0;
}
}
public String getFirst() {
return first;
}
public void setFirst(String first) {
this.first = first;
}
public String getLast() {
return last;
}
public void setLast(String last) {
this.last = last;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
if(salary > 0) {
this.salary = salary;
}
}
}
public class EmployeeTest {
public static void main(String[] args) {
Employee one = new Employee("John","Smith",5000);
Employee two = new Employee("Joe","Schmoe",1250);
System.out.println(one.getFirst() + " " + one.getLast() + " makes $" + one.getSalary() + "/month");
System.out.println(two.getFirst() + " " + two.getLast() + " makes $" + two.getSalary() + "/month");
one.setSalary(one.getSalary() * 1.1);
two.setSalary(two.getSalary() * 1.1);
System.out.println(one.getFirst() + " " + one.getLast() + " makes $" + one.getSalary() + "/month");
System.out.println(two.getFirst() + " " + two.getLast() + " makes $" + two.getSalary() + "/month");
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
