Answer to Question #276545 in Java | JSP | JSF for JAD

Question #276545

- Person class

Create a Person class that implements the above methods. A person should have a last name and an address. It should also be possible to display this information using the toString() method.

- Student class

Create a Student class that implements the above methods. Student must have a program, a year and fee. It should also be possible to display this information using the toString() method.

- Staff class

Create a Staff class that implements the above methods. Staff must have a school name (School) and a salary (pay). It should also be possible to display this information using the toString() method.


1
Expert's answer
2021-12-07T09:21:16-0500


package person;


public class Person {


  private String last_name, address;
  
  public String toString(){
      return "Last name: "+ last_name+"\nAddress: "+address+"\n";
  }
    public static void main(String[] args) {
        
    }
    
}
class Student{
    private String program;
    private int year;
    private double fee;
    public String toString(){
      return "Program: "+ program+"\nYear: "+year+"\nFee: "+ fee+"\n";
  }
} 


class Staff{
     private String school_name;
     private double salary;
     public String toString(){
      return "School name: "+ school_name+"\nSalary: "+salary+"\n";
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS