CS计算机代考程序代写 Java Review:

Review:
CSE148 Object Oriented Programming Homework Set 05
1. OOP principle 1: Encapsulation
2. OOP principle 2: Inheritance
3. Super class and subclass; define subclass by extending from a super class; ¡°super¡±
Write a Java program to:
1. Define Person class:
Data fields:
name: String age: int
gender: boolean
Methods:
constructor
getName(): String
changeName(name: String) : void
getAge(): int
getGender(): String // return a string value ¡°male¡± or ¡°female¡±
toString(): String // return information of a person, which include name, age, gender
2. Define Student class which is extended from Person Student inherit all properties defined in Person class. Data fields (new data fields)
major: String
gpa: double
studentID: String // unique id
(Figure out a solution to manage the generation of unique ¡°studentID¡±)
Methods:
constructor
getGPA(): double
setGPA() : void
getMajor(String major) : String
changeMajor(): void
getStudentID(): String
toString(): String // return all information of a person plus information major & GPA getNextUniqueID(): String // define this static method generate next unique id
SCCC CSE148, Spring 2021

3. Define Faculty class which is extended from Person Faculty inherit all properties defined in Person class. Data fields (new data fields)
department: String
employeeID: String // unique ID
Methods:
constructor(s)
getDepartmentInfo(): String
setDepartment(): void
getEmployeeID (): String
toString(): String // return all information of a person plus employeeID and department getNextEmployeeID(): String // a static method to generate next employee ID
4. Test
(1)
(2)
Test ¡°Student¡± class
(a) Define a Student array; generate some Student objects, and add them into the array.
(b) Define a method to search for student with highest GPA, display this student information:
Student findStudentWithHighestGPA(Student [] students);
(c) Define a method to calculate the average GPA of those student in the array:
double calculateAverageGPA (Student [] students);
Test ¡°Faculty¡± class
(a) Define a Faculty array; generate some Faculty instances and add them to array
(b) Define a method to list all Faculty in same department. Display these faculty¡¯s information.
Faculty []searchForFaculty (Faculty [] faculty, String department);
SCCC CSE148, Spring 2021