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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started