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
14. In cell B14, create a formula without using a function that adds 1 to the value in cell B12 and then multiplies the result b
vagabundo [1.1K]

Answer:

The formula for the given problem is given below:

= (1+B$12)×B13

Explanation:

Immediately you do one, then you can autofill the formula to the mentioned range B15:B17 and then to C14 to H17

When been done correctly, this is how the formula will look in those cells if you do it correctly.

Check the file attached below to see it.

7 0
2 years ago
IS ANYONE ELSE JUST GETTING PPL PUTTING LINKS WHEN U ASK A QUESTION???
TiliK225 [7]
UGH IKR, LIKE JUST ANSWER THE FRICKIN QUESTION
4 0
2 years ago
Read 2 more answers
Describe one activity that belongs to the organizing phase software engineering.
Lera25 [3.4K]

Answer:

can you be more specific

Explanation:

5 0
3 years ago
Read 2 more answers
How many times do you need to click the Format Painter button to apply copied formats to multiple paragraphs one right after the
const2013 [10]

The answer is (A) Twice

Format painter is that icon tool that looks like a paintbrush that is used to pick up formatting of an existing text and then paints it on the next text you select. If you wish to apply the formatting to more than one element, you should double-click the format painter and press esc key to deactivate.


5 0
3 years ago
Read 2 more answers
"Bullet Lists" can be which of the following?
MariettaO [177]

Answer:

letters and numbered

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • The border that defines the outer boundary of a shape or other object
    13·1 answer
  • Mateo could not find the undo command or shortcut. He should _____.
    15·2 answers
  • How does LinkedIn differ from other popular social media platforms? What are the similarities?
    6·1 answer
  • The___provides access to the internet; may also be internal
    11·1 answer
  • True or False
    7·1 answer
  • Gray London is a retired race car driver who helped Dale Earnhardt, Jr. get his start. He is writing a book and making a video a
    9·1 answer
  • What is a characteristic of tasks in Outlook?
    10·2 answers
  • Select the correct answer from each drop down menu
    8·2 answers
  • How do I type over Images (photo posted ​
    12·2 answers
  • Why we need to interpret the drawing and plans
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!