Please make sure test cases pass import static org.junit.jupiter.api.Assertions.*;   import java.util.*; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder;   @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class CSDTest {     @Test     @Order(1)     void CheckChairEmployeeID100(){         ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");         CSD csd = new CSD(chair);         assertEquals(100, chair.getEmployeeID(), "ChairPerson getID Fail");     }     @Test     @Order(2)     void ShouldCompareDeptChairPerson(){         ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");         CSD csd = new CSD(chair);         assertEquals(chair, csd.getChairPerson(), "CS Dept getChairPerson Fail");     }     @Test     @Order(3)     void CheckChairID102AndFacultyID103(){         ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");         CSD csd = new CSD(chair);         Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female",                 "Lawrence Avenue East");         f.setProgram("Computer Science");         assertEquals(102, chair.getEmployeeID(), "ChairPerson getID Fail");         assertEquals(103, f.getEmployeeID(), "Faculty getID Fail");       }     @Test     @Order(4)     void CheckProgramNameCorrect(){         ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");         CSD csd = new CSD(chair);         Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female",                 "Lawrence Avenue East");         f.setProgram("Computer Science");         assertEquals("Computer Science", f.getProgram(), "CS Dept getProgram Fail");         assertFalse(f.getProgram().equals("Computer"), "CS Dept getProgram Fail");     }     @Test     @Order(5)     void CheckToStringChair(){         ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");         chair.setSalary(12345.6);         assertEquals("Chair Person [[[106, 12345.6[Rebert, Jack, 59, Male, Birchmount Road]]]]", chair.toString());     }     @Test     @Order(6)     void CheckToStringFaculty(){         Faculty f = new Faculty("Rebert", "Jack", 59, "Male", "Birchmount Road");         f.setProgram("Computer Science");         f.setSalary(123.4);         assertEquals("Faculty Computer Science[[107, 123.4[Rebert, Jack, 59, Male, Birchmount Road]]]", f.toString());     }     @Test     @Order(7)     void CheckToStringUgrad(){         UGrad s = new UGrad("Rebert", "Jack", 59, "Male", "Birchmount Road") {};         assertEquals("Undergraduate [1000[[Rebert, Jack, 59, Male, Birchmount Road]]]", s.toString());     }     @Test     @Order(8)     void CheckToStringGrad(){         Grad s = new Grad("Rebert", "Jack", 59, "Male", "Birchmount Road") {};         assertEquals("Graduate [1001[[Rebert, Jack, 59, Male, Birchmount Road]]]", s.toString());     }     @Test     @Order(9)     void HireFaculty(){         ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");         CSD csd = new CSD(chair);         Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female","Lawrence Avenue East");         f.setProgram("Software Engineering");         UGrad s = new UGrad("Ryan", "Mark", 35, "Male", "Canlish Road");         try{             csd.HireFaculty(f);         }         catch(NoSpaceException e){         }         assertEquals(f, csd.getFaculty().get(0), "Hire Faculty Failed");         assertEquals(1, csd.getNumOfFaculty(), "Hire Faculty Failed");     }     @Test     @Order(10)     void HireFacultyDuplicate(){         ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");         CSD csd = new CSD(chair);         Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female","Lawrence Avenue East");         f.setProgram("Software Engineering");         UGrad s = new UGrad("Ryan", "Mark", 35, "Male", "Canlish Road");         try{             csd.HireFaculty(f);             csd.HireFaculty(f);         }         catch(NoSpaceException e){         }         assertEquals(f, csd.getFaculty().get(0), "Hire Faculty Failed");         assertEquals(1, csd.getNumOfFaculty(), "Hire Faculty Failed");     }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please make sure test cases pass

import static org.junit.jupiter.api.Assertions.*;

 

import java.util.*;

import org.junit.jupiter.api.MethodOrderer;

import org.junit.jupiter.api.Order;

import org.junit.jupiter.api.Test;

import org.junit.jupiter.api.TestMethodOrder;

 

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)

class CSDTest {

    @Test

    @Order(1)

    void CheckChairEmployeeID100(){

        ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");

        CSD csd = new CSD(chair);

        assertEquals(100, chair.getEmployeeID(), "ChairPerson getID Fail");

    }

    @Test

    @Order(2)

    void ShouldCompareDeptChairPerson(){

        ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");

        CSD csd = new CSD(chair);

        assertEquals(chair, csd.getChairPerson(), "CS Dept getChairPerson Fail");

    }

    @Test

    @Order(3)

    void CheckChairID102AndFacultyID103(){

        ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");

        CSD csd = new CSD(chair);

        Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female",

                "Lawrence Avenue East");

        f.setProgram("Computer Science");

        assertEquals(102, chair.getEmployeeID(), "ChairPerson getID Fail");

        assertEquals(103, f.getEmployeeID(), "Faculty getID Fail");

 

    }

    @Test

    @Order(4)

    void CheckProgramNameCorrect(){

        ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");

        CSD csd = new CSD(chair);

        Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female",

                "Lawrence Avenue East");

        f.setProgram("Computer Science");

        assertEquals("Computer Science", f.getProgram(), "CS Dept getProgram Fail");

        assertFalse(f.getProgram().equals("Computer"), "CS Dept getProgram Fail");

    }

    @Test

    @Order(5)

    void CheckToStringChair(){

        ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");

        chair.setSalary(12345.6);

        assertEquals("Chair Person [[[106, 12345.6[Rebert, Jack, 59, Male, Birchmount Road]]]]", chair.toString());

    }

    @Test

    @Order(6)

    void CheckToStringFaculty(){

        Faculty f = new Faculty("Rebert", "Jack", 59, "Male", "Birchmount Road");

        f.setProgram("Computer Science");

        f.setSalary(123.4);

        assertEquals("Faculty Computer Science[[107, 123.4[Rebert, Jack, 59, Male, Birchmount Road]]]", f.toString());

    }

    @Test

    @Order(7)

    void CheckToStringUgrad(){

        UGrad s = new UGrad("Rebert", "Jack", 59, "Male", "Birchmount Road") {};

        assertEquals("Undergraduate [1000[[Rebert, Jack, 59, Male, Birchmount Road]]]", s.toString());

    }

    @Test

    @Order(8)

    void CheckToStringGrad(){

        Grad s = new Grad("Rebert", "Jack", 59, "Male", "Birchmount Road") {};

        assertEquals("Graduate [1001[[Rebert, Jack, 59, Male, Birchmount Road]]]", s.toString());

    }

    @Test

    @Order(9)

    void HireFaculty(){

        ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");

        CSD csd = new CSD(chair);

        Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female","Lawrence Avenue East");

        f.setProgram("Software Engineering");

        UGrad s = new UGrad("Ryan", "Mark", 35, "Male", "Canlish Road");

        try{

            csd.HireFaculty(f);

        }

        catch(NoSpaceException e){

        }

        assertEquals(f, csd.getFaculty().get(0), "Hire Faculty Failed");

        assertEquals(1, csd.getNumOfFaculty(), "Hire Faculty Failed");

    }

    @Test

    @Order(10)

    void HireFacultyDuplicate(){

        ChairPerson chair = new ChairPerson("Rebert", "Jack", 59, "Male", "Birchmount Road");

        CSD csd = new CSD(chair);

        Faculty f = new Faculty("Elizabeth", "Smith", 53, "Female","Lawrence Avenue East");

        f.setProgram("Software Engineering");

        UGrad s = new UGrad("Ryan", "Mark", 35, "Male", "Canlish Road");

        try{

            csd.HireFaculty(f);

            csd.HireFaculty(f);

        }

        catch(NoSpaceException e){

        }

        assertEquals(f, csd.getFaculty().get(0), "Hire Faculty Failed");

        assertEquals(1, csd.getNumOfFaculty(), "Hire Faculty Failed");

    }

   

Task1:
• Read the problem description and check the Junit test cases to identify all the implicit
and explicit entities stated in the scenario and design a suitable class hierarchy for the
CSD department. Add appropriate constructors, accessor/getter, mutator/setter
methods to provide basic functionality to the classes. Also, appropriately redefine
equals() and toString() methods while using the class attributes.
Task2:
Implement the following operations relevant to the appropriate classes you have defined.
• AdmitStudent: when the department admits a new undergraduate student
a. You need to add the student information to the department student record
b. You need to assign a faculty to every newly admitted undergrad student,
and then the student will be added to the corresponding faculty record.
c. The undergrad students are assigned to faculty on a first-come-first-serve
basis.
d. The department should not admit the same student twice (i.e., no
duplicate student in the university -student record)
AlumnusUGrad: when a student graduates from the university, you need to
clear/remove the student's information from the university students' record.
HireTAs: when the department admits a new graduate student,
a. you need to store the grad student information in the department grad
record and
b. You need to assign the grad student as a TA to a faculty who has not
exceeded the TAs limit yet.
a. The department cannot admit the same grad student twice. Hence,
there is no duplicate.
b. The TAs are assigned to faculty on a first-come-first-serve basis.
AlumnusGrad: when a Grad student graduates, you need to clear/remove the
student information from the department's record.
Page | 5
ExtractAllUGradDetails: you need to extract and return all the undergraduate
students information stored in the university students' record as a sorted list of
students according to the student's full name.
a. The student's full name is defined as a concatenation of first name and last
name as follows: if a student's first name is "John" and the last name is
"Smith", the student's full name is "John, Smith"
• ExtractAllFacultyDetails: you need to extract and return all the information of faculty
members stored in the university faculty records as a sorted list of faculty according to
the faculty's full name.
a. The faculty's full name is defined as a concatenation of first name and last name
as follows: if a faculty's first name is "Sara" and the last name is "Adams", the
faculty's full name is "Sara, Adams".
ExtractAllGradDetails: you need to extract and return all the Grad students
information stored in the department record as a list of Grad Students.
ExtractAviseesDetails: you need to extract and return all the students information
that are advisees of a particular faculty as a sorted list of students according to the
student's full name.
a. The student's full name is defined as a concatenation of first name and last
name as follows: if a student's first name is "John" and the last name is
"Smith", the student's full name is "John, Smith".
• ExtractTAsDetails: you need to extract and return all the Grad student information
assigned to a particular faculty as a list of TAS.
• ExtractFaculty Details: you need to extract and return all the faculty
information belonging to a particular program as a sorted list of faculty
members according to the faculty's full name.
a. The faculty's full name is defined as a concatenation of first name and last name
as follows: if a faculty's first name is "Sara" and the last name is "Adams", the
faculty's full name is "Sara, Adams".
HireFaculty: when the University hires a new faculty member
a. You need to add the faculty information to the university faculty records.
b. The newly hired faculty is assigned to the designated Program Director
according to the specialty of faculty member, and then the hired faculty
will be added to the corresponding Program Director's record
responsible of the same program.
c. The university cannot hire the same faculty twice. Hence, there are no
duplicates.
RetireFaculty: when a faculty is retired from the university
a. You need to remove the faculty member's information from the
university faculty records.
b. The designated Program Director will assign the students of the
retired faculty to the next available faculty member (or members).
c. Reassign the TAs for the next available Faculty (or Faculties).
d. When reassigning advisees and TAs, there can be a scenario where all the
faculty members in the university have reached their quota of advisees and
cannot handle the remaining students, or no TAs are needed. At this point,
ignore these specific cases and implement this operation, assuming these
steps can be achieved successfully.
.
• Optional: It is highly recommended that you write and add your Junit test cases to test
and show the output of the above implementations.
Transcribed Image Text:Task1: • Read the problem description and check the Junit test cases to identify all the implicit and explicit entities stated in the scenario and design a suitable class hierarchy for the CSD department. Add appropriate constructors, accessor/getter, mutator/setter methods to provide basic functionality to the classes. Also, appropriately redefine equals() and toString() methods while using the class attributes. Task2: Implement the following operations relevant to the appropriate classes you have defined. • AdmitStudent: when the department admits a new undergraduate student a. You need to add the student information to the department student record b. You need to assign a faculty to every newly admitted undergrad student, and then the student will be added to the corresponding faculty record. c. The undergrad students are assigned to faculty on a first-come-first-serve basis. d. The department should not admit the same student twice (i.e., no duplicate student in the university -student record) AlumnusUGrad: when a student graduates from the university, you need to clear/remove the student's information from the university students' record. HireTAs: when the department admits a new graduate student, a. you need to store the grad student information in the department grad record and b. You need to assign the grad student as a TA to a faculty who has not exceeded the TAs limit yet. a. The department cannot admit the same grad student twice. Hence, there is no duplicate. b. The TAs are assigned to faculty on a first-come-first-serve basis. AlumnusGrad: when a Grad student graduates, you need to clear/remove the student information from the department's record. Page | 5 ExtractAllUGradDetails: you need to extract and return all the undergraduate students information stored in the university students' record as a sorted list of students according to the student's full name. a. The student's full name is defined as a concatenation of first name and last name as follows: if a student's first name is "John" and the last name is "Smith", the student's full name is "John, Smith" • ExtractAllFacultyDetails: you need to extract and return all the information of faculty members stored in the university faculty records as a sorted list of faculty according to the faculty's full name. a. The faculty's full name is defined as a concatenation of first name and last name as follows: if a faculty's first name is "Sara" and the last name is "Adams", the faculty's full name is "Sara, Adams". ExtractAllGradDetails: you need to extract and return all the Grad students information stored in the department record as a list of Grad Students. ExtractAviseesDetails: you need to extract and return all the students information that are advisees of a particular faculty as a sorted list of students according to the student's full name. a. The student's full name is defined as a concatenation of first name and last name as follows: if a student's first name is "John" and the last name is "Smith", the student's full name is "John, Smith". • ExtractTAsDetails: you need to extract and return all the Grad student information assigned to a particular faculty as a list of TAS. • ExtractFaculty Details: you need to extract and return all the faculty information belonging to a particular program as a sorted list of faculty members according to the faculty's full name. a. The faculty's full name is defined as a concatenation of first name and last name as follows: if a faculty's first name is "Sara" and the last name is "Adams", the faculty's full name is "Sara, Adams". HireFaculty: when the University hires a new faculty member a. You need to add the faculty information to the university faculty records. b. The newly hired faculty is assigned to the designated Program Director according to the specialty of faculty member, and then the hired faculty will be added to the corresponding Program Director's record responsible of the same program. c. The university cannot hire the same faculty twice. Hence, there are no duplicates. RetireFaculty: when a faculty is retired from the university a. You need to remove the faculty member's information from the university faculty records. b. The designated Program Director will assign the students of the retired faculty to the next available faculty member (or members). c. Reassign the TAs for the next available Faculty (or Faculties). d. When reassigning advisees and TAs, there can be a scenario where all the faculty members in the university have reached their quota of advisees and cannot handle the remaining students, or no TAs are needed. At this point, ignore these specific cases and implement this operation, assuming these steps can be achieved successfully. . • Optional: It is highly recommended that you write and add your Junit test cases to test and show the output of the above implementations.
Problem Description:
You are hired to build a software for a new Computer Science (CS) department, or CSD for short
You are required to write an object-oriented program that implements a scenario of CS personnel
subsystem. The following UML diagram shows an overview architecture of the department's
personnel. The UML diagram shows the inheritance relationship among the classes. It should be
noted here that this UML diagram is not complete. Hence, you need to read the problem
description carefully to determine the attributes and methods for each class. Also, you need to
read the JUnit test file CSDTest.java.
Moreover, you need to determine if the class is abstract, or concrete based on the problem
description. Therefore, if you look at the startup PE2 project, you will find the package pe2 with
CSD.java file, which does not contain any functional code, as you are supposed to read this
diagram and implement the code in CSD. java. You must create your classes inside the
CSD.java file after reading the problem description.
Remember that you need to follow best 00 practices while implementing the solution for
the CS department scenario (i.e., object-oriented encapsulation, abstraction, information
hiding,... etc.)
Page 13
Academics
A
Administrator
Program
Director
Faculty
Chairperson
Person
A
Student
A
UGrad
7
<<Interface>>
Comparable
CS Department
Grad
NoSpecialtyException
NoSpaceException
NOTAException
General information and Configuration about the CS Department:
• The CSD has as a community, a group of: Academics that can be Administrators, or
Faculty members.
CSD admits Students to its programs. A Student can be a Graduate or Undergraduate.
A Grad student can work in the CSD as a TA with a faculty member.
The CSD stores the following information about any TA: First name, Last name,
Age, Gender, Student ID, and Address
•
The CSD stores the following information about any academic, faculty or
administrator: First Name, Last name, Age, Gender, Employee ID, Address and Salary.
• The CSD assigns a unique employee ID to each Academic, faculty, or administrator.
Employee IDs start at 100.
• The university stores the following information about admitted students: First
Name, Last name, Age, Gender, Student ID and Address.
The university assigns a unique Student ID to each student starting from 1000.
The university is not allowed to have duplicate student records.
An Undergrad Student has a designated Faculty assigned as an academic advisor.
• A Faculty can have several undergrad Students assigned at the same time.
• Any Grad student can be assigned to any faculty.
There are two types of academic administrator roles: Chairperson and Program Director.
There is only one Chairperson for the department. The Chairperson overlooks
and manages all the Program Directors.
• Faculty members belong to one of the following 3 programs: Computer
Science, Software Engineering, and Digital Technology.
• There is one Program Director for each of these programs, and a program director
overlooks and manages only faculty members in the same program.
It is essential to know that CSD has the following restrictions:
• Number of Chairpersons: 1
• Number of Program Directors: 3
• Number of Faculty assigned to a Program Director: Up to a maximum of 25
• Number of Faculty members: Up to a Maximum of 70
Number of Grad students: Up to a Maximum of 150
Number of Undergrad Students: Up to a Maximum of 500
• Number of Grad students assigned to a Faculty as TAs: Up to a maximum of 5
. • Number of Undergrad students assigned to a Faculty for advising: Up to a maximum of 8
Transcribed Image Text:Problem Description: You are hired to build a software for a new Computer Science (CS) department, or CSD for short You are required to write an object-oriented program that implements a scenario of CS personnel subsystem. The following UML diagram shows an overview architecture of the department's personnel. The UML diagram shows the inheritance relationship among the classes. It should be noted here that this UML diagram is not complete. Hence, you need to read the problem description carefully to determine the attributes and methods for each class. Also, you need to read the JUnit test file CSDTest.java. Moreover, you need to determine if the class is abstract, or concrete based on the problem description. Therefore, if you look at the startup PE2 project, you will find the package pe2 with CSD.java file, which does not contain any functional code, as you are supposed to read this diagram and implement the code in CSD. java. You must create your classes inside the CSD.java file after reading the problem description. Remember that you need to follow best 00 practices while implementing the solution for the CS department scenario (i.e., object-oriented encapsulation, abstraction, information hiding,... etc.) Page 13 Academics A Administrator Program Director Faculty Chairperson Person A Student A UGrad 7 <<Interface>> Comparable CS Department Grad NoSpecialtyException NoSpaceException NOTAException General information and Configuration about the CS Department: • The CSD has as a community, a group of: Academics that can be Administrators, or Faculty members. CSD admits Students to its programs. A Student can be a Graduate or Undergraduate. A Grad student can work in the CSD as a TA with a faculty member. The CSD stores the following information about any TA: First name, Last name, Age, Gender, Student ID, and Address • The CSD stores the following information about any academic, faculty or administrator: First Name, Last name, Age, Gender, Employee ID, Address and Salary. • The CSD assigns a unique employee ID to each Academic, faculty, or administrator. Employee IDs start at 100. • The university stores the following information about admitted students: First Name, Last name, Age, Gender, Student ID and Address. The university assigns a unique Student ID to each student starting from 1000. The university is not allowed to have duplicate student records. An Undergrad Student has a designated Faculty assigned as an academic advisor. • A Faculty can have several undergrad Students assigned at the same time. • Any Grad student can be assigned to any faculty. There are two types of academic administrator roles: Chairperson and Program Director. There is only one Chairperson for the department. The Chairperson overlooks and manages all the Program Directors. • Faculty members belong to one of the following 3 programs: Computer Science, Software Engineering, and Digital Technology. • There is one Program Director for each of these programs, and a program director overlooks and manages only faculty members in the same program. It is essential to know that CSD has the following restrictions: • Number of Chairpersons: 1 • Number of Program Directors: 3 • Number of Faculty assigned to a Program Director: Up to a maximum of 25 • Number of Faculty members: Up to a Maximum of 70 Number of Grad students: Up to a Maximum of 150 Number of Undergrad Students: Up to a Maximum of 500 • Number of Grad students assigned to a Faculty as TAs: Up to a maximum of 5 . • Number of Undergrad students assigned to a Faculty for advising: Up to a maximum of 8
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education