Consider the Person and Student class that we developed previously. Write a clas
ID: 3702676 • Letter: C
Question
Consider the Person and Student class that we developed previously. Write a class called Employee class. The Employee class extends the Person class and it contains .two instance variable named jobTitle (of type String) and pay (of type double) A constructor that creates a Employee instance with the given parameters. Getters and setters for instance variables jobTitle and pay. A toString0 that returns a short description of the instance Write the Employee class in the answer box below assuming that the Person class has been done for you in the Code Runner System.Note keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks For example: Test Result Employee sf new Employee("Mike", 36, "Manager, 5500) Emp loyee [Mike(36), Manager, 55000.00] System.out.println(sf);Explanation / Answer
//Assuming Person class has a constructor Person(name,age)
public class Employee extends Person{
private float sal;
private String jobTitle;
Employee(String name,int age,String jb,float s){
super(name,age);
jobTitle = jb;
sal = s;
}
public float getSalary(){
return sal;
}
public String getJobTitle(){
return jobTitle;
}
public void setSalary(float s){
sal = s;
}
public void setJobTitle(String jb){
jobTitle = jb;
}
public String toString(){
return "Employee["+super.toString()+","+jobTitle+","+sal+"]";
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.