Question: Create a Graduate class add another attribute (a String) called degree, which is either Masters or Doctorate, and a boolean called thesis (meaning whether they

Create a Graduate class 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).

Here is what I have:

Person.java:

public class Person { protected String name; public Person(){ name = null; } public Person(String name){ this.name=name; } public String getName(){ return name; } public void setName(String Name){ this.name=name; } public boolean hasSameName(Person b){ if (this.name == (b.name)) return true; else return false; } public void writeOutput(){ System.out.print("Name: "+ name); } }

Student.java:

public class Student extends Person { protected int studentNumber; public Student(){ super(); studentNumber= 0; } public Student(String name, int studentNumber){ super(name); this.studentNumber = studentNumber; } public int getStudentNumber(){ return studentNumber; } public void setStudentNumber(int studentNumber){ this.studentNumber=studentNumber; } public boolean equals(Student b){ if (this.studentNumber == b.studentNumber) return true; else return false; } public void writeOutput(){ super.writeOutput(); System.out.println(" Student Number: "+ studentNumber); } }

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!