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

Help in JAVA: Create a Graduate class derived from Student, and add another attr

ID: 3795573 • Letter: H

Question

Help in JAVA:

Create a Graduate class derived from Student, and add another attribute (a String) called degree, which is either "Masters" or "Doctorate", and a boolean called thesis (meaning whether they have completed their thesis and initially set to false).

Create a Faculty class, and a Staff class. The Faculty class should have an attribute to store the Faculty's title (a String) for example "Instructor", "Assistant Professor". The Staff class should have an attribute called pay grade (an integer from 1 to 20) .

What I have: I already have Student, Person, Undergrad and Employee.

Graduate.java

public class Graduate extends Student{
private String degree;

public Graduate(){
super();
degree=" ";
}
public Graduate(String initialDegree, String initialName, int initialStudentNumber){
super(initialName, initialStudentNumber);
degree=initialDegree;
}
public boolean thesis(){
return false;
}

public String getDegree() {
return degree;
}

public void setDegree(String degree) {
this.degree = degree;
}
public void writeOutput(){
super.WriteOutput();
System.out.println("Degree: "+ degree);
  
}
public boolean equals(Graduate otherGraduate){
return this.degree == otherGraduate.degree;
}
}

Faculty.java

public class Faculty extends Employee {
private String title;
  
public Faculty(){
super();
title= " ";
}
public Faculty(String initialName, String initialTitle){
super(initialName);
title=initialTitle;
  
}
  
public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}
public void Reset(String newName){
setName(newName);
  
}
  
public void WriteOutput(){
super.WriteOutput();
System.out.println("Title: "+title);
}
public boolean Equals(Faculty other){
return this.hasSameName(other)&&(this.title==other.title);
}
}

Staff.java

public class Staff extends Employee {
int payGrade;
public Staff(){
super();
payGrade=0;
}
}

Explanation / Answer

Graduate.java

Staff.java

Faculty.java - no changes

Output - As you didn't provide the files from which these classes are derived, can't test for any output. What you asked for in this questions about setting attributes is explained with the help of comments.