CS计算机代考程序代写 1. Define a class: Employee Data fields:

1. Define a class: Employee Data fields:
name:String gender:String salary:double employeeID: int
Methods:
// each employee has a unique id. define any other members or // methods to manage this id (generation, assignment)
CSE148 MIDTERM EXAM, SPRING-2021
CSE148 Object Oriented Programming Midterm
constructor: // default constructor, initialize data fields with following default values: // (name: ¡°anonymous¡±, gender: ¡°male¡±, salary: 80000.0)
constructor: // initialize data fields from input arguments
Getter/setter to set/get properties of name, gender and salary
(Overridden methods)
toString():String // return information of an employee equals(o:Object):boolean; // define a rule to compare 2 employees and return true|false
2. Define class: Class: Staff, which is inherited from Employee Data fields:
Name_________________
role:String Methods:
constructor:
constructor:
Getter/setter to set/get role property
(Overridden methods)
toString():String // return information of a staff: name, gender, role, salary equals(o:Object):boolean
Page 1 of 3
// valid values are: administrator, secretary, specialist, …
// default constructor
// initialize data fields from input arguments

4. Define class: Class: College Data fields:
collegeName:String employees:ArrayList
Methods:
// college name
// a list of all employees in a college
CSE148 MIDTERM EXAM, SPRING-2021
3. Define class: Faculty, which is inherited from Employee Data fields:
department:String // values: math, computer science, engineering, …
rank:String Methods:
constructor:
constructor:
Getter/setter to set/get properties of department and rank
(Overridden methods)
toString():String // return information of an faculty: name, gender, department, rank, salary equals(o:Object):boolean
// professor, associate professor, assistant professor, instructor
// default constructor
// initialize data fields from input arguments
Page 2 of 3
constructor: // default constructor, default name is ¡°college¡±, the default number of // employees is 100
constructor: // initialize data fields from input arguments
Getter/setter to set/get collegeName
addEmployee(employee:Employee): boolean // add an employee into employee list
// return true|false to indicate if operation is successful or failed removeEmployee (employee:Employee): boolean // remove an employee from list
// return true|false to indicate if operation is successful or failed
searchForFaculties(department:String, rank:String):ArrayList
// input parameter: department: department name or ¡°all¡±.
// If it is ¡°all¡±, return all faculties from all departments // input parameter: rank: instructor | assistant | associate | professor | all. // If it is ¡°all¡±, return all faculties of any rank
(Overridden methods)
toString():String // return these information: college name, number of staffs, // number of faculties

CSE148 MIDTERM EXAM, SPRING-2021
5. Define a method to read from a text file ¡°word.txt¡±, count the occurrence of word ¡°SCCC¡± in this file, return this number. Method:
int countOccurenceOfWordInFile(String filename);
6. Test
(1) Generate a ¡°College¡± object named ¡°mySCCC¡±. College name: SCCC (2) Generate a few Employee instances, add them into mySCCC.
(3) Search for faculties with rank ¡°professor¡± in ¡°math¡± department.
(4) Search all faculties in all departments.
(5) Call method countOccurenceOfWordInFile();
Page 3 of 3