1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Aloiza [94]
3 years ago
13

Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A

person has a name, address, phone number and e-mail address. A student has a class status (freshman, sophomore, junior or senior). Define the status as constant. An employee has an office, salary, and experience (number of years, integer value). A faculty member has office hours and a rank. A staff member has a title. Override the toString method in each of the class to display the class name and the person’s name.
Computers and Technology
1 answer:
harina [27]3 years ago
3 0

Answer:

se explaination

Explanation:

//Design a class named Person

public class Person

{

//A 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=phNum;

email=pemail;

}

// toString() method to return the name

public String toString()

{

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)

{

status = "sophomore";

}

if(Status == 3)

{

status = "junior";

}

if(Status == 4)

{

status = "Senior";

}

status = "Student";

}

public String toString()

{

return super.toString() + " " + status;

}

}

------------------------------------------------------

//Employee.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() + " " + office +" " + salary);

}

}

--------------------------------------------------------

//Faculty.java

public class Faculty extends Employee

{

//A faculty member has office hours and a rank.

String officeHours;

String rank;

//Constructor with arguments

public Faculty(String name,String address,String phonenumber,String email,String off,int salary,String offHours,String ranks)

{

super(name,address,phonenumber,email,off,salary);

officeHours=offHours;

rank=ranks;

}

public String toString()

{

return (super.toString() + " " + officeHours +" " + rank);

}

}

-----------------------------------------------------------------------------

//Staff.java

public class Staff extends Employee

{

//A staff member has a title

String title;

//Constructor with arguments

public Staff(String name,String address,String phonenumber,String email,String off,int salary,String ti t)

{

super(name,address,phonenumber,email,off,salary);

title=ti t;

}

public String toString()

{

return (super.toString() + " " + title);

}

}

You might be interested in
Python is an example of a low level programming language true or false?​
alekssr [168]
False- python is an example of a high level language. Other high levels are c++, PHP, and Java
6 0
3 years ago
Why might a peer-to-peer network not be the best choice for a large corporate office setting?
omeli [17]

Answer:

a it is less private

Explanation:

8 0
3 years ago
What is an example of the most important role of a systems analyst in any corporation?
dsp73

Answer: The system analyst is one of the most important members in any organisation. These system analyst has to analyse different data of the organisation which would help to bring out the different any new business policy changes or any kind of improvement.

Explanation:

An example to know this better would be the system analyst of a telecom company. Here the role of the system analyst would be bring out the design and implementation of new telecom information system and also should be aware of previous data of the organization. The system analyst would also be responsible to bring out the new business policies based on latest telecom standards and ensure the systems conforms to the latest standards.

5 0
2 years ago
Which type of storage disk and disk drive can you use in the given situation?
Margarita [4]

Answer:

The answer to this question is DVD and DVD-RW

Explanation:

6 0
3 years ago
What is the most important factors to consider when designing a powerpoint presentation?
balandron [24]
It is always helpful to choose a template, and an attractive theme to begin with. Next, display only the keywords or phrases that you need in your PowerPoint. This will help it look less boring (if its a whole paragraph of writing, it looks boring). Lastly, it is important to add visuals or images to your PowerPoint. Google Slides is also very convenient to use. Please message me if you have any other concerns! 
3 0
3 years ago
Read 2 more answers
Other questions:
  • A ________ is a system of hardware and software that stores user data in many different geographical locations and makes that da
    14·1 answer
  • What is the final step used when designing an algorithm?
    14·1 answer
  • What is PHP language
    12·1 answer
  • 2 negative impact of excessive use of computer even in solving mathematical problem.
    11·1 answer
  • You want to know what directories in your account hold C files. You can use the command:______.
    9·1 answer
  • The labels on the tab buttons on the Driver tab of the Windows Device are Driver Details, Update Driver, Roll Back Driver, Unins
    12·1 answer
  • What command is most effective at identifying different types of files?
    6·1 answer
  • Please help please I will count your answer brainiest if you help!
    8·1 answer
  • 10010 - 1011 binary subtraction​
    5·1 answer
  • Write a class called TextProcessor that implements the methods listed below. Your implementation may use the charAt() and length
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!