Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use this program to modify the below program Design a class named Person

ID: 3827434 • Letter: P

Question

Please use this program to modify the below program

Design a class named Person i. Person has a data field: name. Default: name is "unknown", ii. Person has a method printlnfo() which will print all data fields. iii. and its two subclasses named Student and Employee. b. Design a class named Employee which is a subclass of Person. i. Employee has a data field: salary. Default: salary is 0, ii. Employee has a method printlnfo()which will print all data fields(includir data fields In super class) c. Design a class named Faculty which is a subclass of Employee. i. Faculty has a data field: dept. Default: dept is "none", ii. Faculty has a method printlnfo()which will print all data fields(including data fields in super class) d. Design a class named Student which is a subclass of Person. i. Student has two data fields: age. default 0; email address, default: "none" ii. Student has a method print Info()which will print all data fields(including data fields in super class) e. Implement necessary constructors, accessor and mutator methods for all the above classes. Write a test program to create two Students and two Faculties, assign (NOT read from console) the following information, and invokes their printlnfo methods, xxxx is your Kean ID. A Student object name: unknown, age: -1, email: none A Student object name: "demo_s2". age: 23, email: xyz@gmail.com A Faculty object name: "demo_fl", salary: -1, dept: none A Faculty object name: "demo_f2", salary: 10000. dept: "CS" Your program output should look like below: Student name: unknown, age: -1, Email: none Student name: demo_s2, age: 23, Email: xyz@gmail.com Faculty name: demo_fl, salary: -1, dept: none Faculty name: demo_f2, salary: 10000, dept: CS Program4 is developed by . This project should be coded in ONE java file. Modify program4 to meet the following requirements: Make Person, Employee classes to abstract classes. Add an interface interface working with a method teach () interface working (void teach(String course);1 Modify Faculty class.Design a class named Person i. Person has a data field: name. Default: name is "unknown", ii. Person has a method printlnfo() which will print all data fields. iii. and its two subclasses named Student and Employee. b. Design a class named Employee which is a subclass of Person. i. Employee has a data field: salary. Default: salary is 0, ii. Employee has a method printlnfo()which will print all data fields(includir data fields In super class) c. Design a class named Faculty which is a subclass of Employee. i. Faculty has a data field: dept. Default: dept is "none", ii. Faculty has a method printlnfo()which will print all data fields(including data fields in super class) d. Design a class named Student which is a subclass of Person. i. Student has two data fields: age. default 0; email address, default: "none" ii. Student has a method print Info()which will print all data fields(including data fields in super class) e. Implement necessary constructors, accessor and mutator methods for all the above classes. Write a test program to create two Students and two Faculties, assign (NOT read from console) the following information, and invokes their printlnfo methods, xxxx is your Kean ID. A Student object name: unknown, age: -1, email: none A Student object name: "demo_s2". age: 23, email: xyz@gmail.com A Faculty object name: "demo_fl", salary: -1, dept: none A Faculty object name: "demo_f2", salary: 10000. dept: "CS" Your program output should look like below: Student name: unknown, age: -1, Email: none Student name: demo_s2, age: 23, Email: xyz@gmail.com Faculty name: demo_fl, salary: -1, dept: none Faculty name: demo_f2, salary: 10000, dept: CS Program4 is developed by . This project should be coded in ONE java file.) Modify program4 to meet the following requirements: Make Persom, Employee classes to abstract classes. Asds an interface interface working with a method teach () interface working (void teach(String course)) Modify Faculty class. a. Add a private data field: course Modify Faculty class as a subclass of Employee and implement working c. Modify to String{or print Info) method to print out course in addition to the existing information. d. Modify existing Faculty constructor to accept course as parameter, and use teach method to assign the input course. Handle exceptions in Employee salary: If salary arc negative, handle the exception by append "(with invalid salary)" to name. Modify test program to assign course to Faculty objects. Write a test program to create two Students and two Faculties, assign (NOT read from console) the following information, and invokes their printInfo methods, xxxx is your Kean ID. A Student object name: unknown, age: - 1, email: none A Student object name: "demo_s2", age. 23, email: xyz@gmail.com A Faculty object name: "dcmo_f1", salary: 0. dept: none, course: none A Faculty object name, "demo_f2", salary: -10000, dept: "CS", course: CPS223l Program6 is developed by . This project should be coded in One java file.

Explanation / Answer

import java.util.*;


class Person
{
private String name;
  
public Person()
{
name = "unknown";
}
  
public Person(String name)
{
this.name = name;
}
public String printInfo()
{
return "Name : "+name;
}
}
class Employee extends Person
{
private double salary;
  
public Employee()
{
salary = 0;
}
public Employee(String name,double salary)
{
super(name);
this.salary = salary;
}
public String printInfo()
{
  
return super.printInfo()+"Salary : "+salary;
}
}
class Faculty extends Employee
{
  
private String dept;
public Faculty()
{
dept = "none";
}
public Faculty(String name,double salary,String dept)
{
super(name,salary);
this.dept = dept;
}
public String printInfo()
{
  
return " A faculty Object : "+super.printInfo()+ "Department : "+dept;
}
}
class Student extends Person
{
private int age;
private String email;
public Student()
{
age = 0;
email = "none";
}
  
public Student(String name,int age,String email)
{
super(name);
this.age = age;
this.email = email;
}
public String printInfo()
{
  
return " A student Object : "+ super.printInfo()+" Age : "+age+ " Email address : "+email;
}
}
class Test
{
   public static void main (String[] args)
   {
   Student s1 = new Student();
   Student s2 = new Student("demo_s2",23,"xyz@mail.com");
   Faculty f1 = new Faculty();
   Faculty f2 = new Faculty("demo_f2",10000,"CS","CPS2231");
  
   System.out.println(s1.printInfo());
   System.out.println(s2.printInfo());
   System.out.println(f1.printInfo());
   System.out.println(f2.printInfo());
  
   }
}

Output:


A student Object : Name : unknown Age : 0 Email address : none

A student Object : Name : demo_s2 Age : 23 Email address : xyz@mail.com

A faculty Object : Name : unknownSalary : 0.0Department : none

A faculty Object : Name : demo_f2Salary : 10000.0Department : CS Course : CPS2231