Question: Note: Mod ified code ( add ed new code ) highlight ( bold ) w ith grey color background. / / Design a class named

Note: Mod ified code (add ed new code) highlight (bold) w ith grey color background.
//Design a class named Person
//Person. java
public class Person
{
??? person has a name, address, phone number, and email address.
String name;
String address;
String phone;
String email;
//Constructor with arguments
public Person(String pname,String paddress, String phNum, String pemail)
{
name = pname ;
address=paddress;
phone=phivum;
email=pemail;
]
(/ tostring() method to return the name
public String toString()
t.
return getClass().getName()+""+name;
]
}
??? Student . java
public class Student extends Person
{
??? A student has a class status
//(freshman, sophomore, junior, or senior).
//Define the status as a constant.
final int freshman =1;
final int sophomore =2;
final int junior=3;
final int senior =4;
String status="freshman";
??? Constructor with arguments
public Student(String name, String address, String phonenumber,
String email, int Status)
{
super (name, address, phonenumber, email);
if (Status ==1)
{
status = "freshman";
}.
if (Status ==2
f
status = "sophomore";
}.
if (Status ==3)
I.
status = "junior";
}.
if Status ==4
i
status = "Senior";
}.
status = "Student";
1
public String toString()
i
return super, toString ()+"+ status;
}
}
??? Emplovee.java
public class Employee extends Person
{
??? An employee has an office, salary, and date hired.
String office;
double salary;
java.util.Date dateHired;
//Constructor with arguments
public Employee (String name, String address, String phonenumber,
String email, String off, double sal)
{
super (name, address, phonenumber, email):
office=off;
}.
salary=sal;
public String toString()
{
return (super.toString ()+n+ office +""+ salary):
3
 Note: Mod ified code (add ed new code) highlight (bold) w

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!