Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Suppose we are designing a college record - keeping program that has records for students. Students. The student has the ability to start from

JAVA
Suppose we are designing a college record-keeping program that has records for students.
Students. The student has the ability to start from the beginning (reset) at any point, i.e., a student in 3rd year can start from the beginning with the same major or a different one. We have two kinds of students:
Undergraduate Students. Undergraduate students have the following properties:
Name, StudentNumber, Major, and Level (freshman, sophomore, junior, senior)
Graduate Students. Graduate students have the following properties:
Name, StudentNumber, Major, and Degree (Master, Doctoral)
This is the code for Student class:
public class Student extends Person{
// PERSON CLASS SHOULD HAVE "TYPE" STRING FOR OUTPUT
protected int studentNumber;
protected String major;
// CONSTRUCTORS
Student(){
}
Student(String initialName, int initialStudentNumber, String major){
this.name = initialName;
this.studentNumber = initialStudentNumber;
this.major = major;
}
public void reset(String newName, int newStudentNumber, String newMajor){
this.name = newName;
this.studentNumber = newStudentNumber;
this.major = newMajor;
}
// SETTERS
public void setStudentNumber( int newNumber){
this.studentNumber = newNumber;
}
public void setMajor( String newMajor ){
this.major = newMajor;
}
// GETTERS
public int getStudentNumber(){
return this.studentNumber;
}
public String getMajor(){
return this.major;
}
// OUTPUT
public void writeOutput(){
System.out.println(" Name: "+ this.name);
System.out.println(" Type: "+ this.type);
System.out.println(" Student Number: "+ this.studentNumber);
System.out.println(" Student Major: "+ this.major);
System.out.println("------------------");
}
// OVERRIDDING EQUALS FOR OBJECT
@Override
public boolean equals( Student otherStudent ){
// CHECK FOR SAME OBJECT
if ( otherStudent == this ){
return true;
}
return this.name.equals(otherStudent.name) &&
this.major.equals(otherStudent.major);
}
}
I need code for class GraduateStudent extends Student

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions