Question
Write a class Department that represents a department in college. It should contain instance data: name (of the department), numberFaculty, numberStudents, and chair. Define Departments
Write a class Department that represents a department in college. It should contain instance data: name (of the department), numberFaculty, numberStudents, and chair. Define Departments constructor to accept and initialize all instance data. Include getter (accessor) and setter (mutator) methods for all instance data. Provide a toString method that returns one line description of the Deapartment's data as a String. Provide method isLarge() that returns a boolean true if the department has over 100 students or false otherwise.
Create a TestDepartment class with main method in it. Within main method instantiate three department objects named deptCS, deptPHYS and deptMATH. CS and MATH should be large and PHYS is not.
- For each department object invoke methods toString and isLarge.
- Have object deptCS to invoke getFaculty method and display number of faculty. After that invoke setFaculty which will add one more faculty after succesful nationwide search was conducted for Computer Science department. Display number of faculty before and after the search.
- Method setStudents should be invoked to increase number of students by 27 after open house in Mathematics department. Display number of faculty before and after the open house.
- Physics department had two faculty that retired as new semester started, and, in addition, their number of students went down by 2 students. Display their number of students and number of faculty before and after the new semester.
Provide appropriate print statements to explain the result of each invoked method so that user understands what happened.
Each class should start with comment with your name, section number and days meeting, project number, and date submitted. Include also comments to provide descriptions of topics practiced for classes Department and TestDepartment. Do not leave Write description of class .. here. comment from BlueJ.
- Java files for classes Department and TestDepartment
- Picture of programs output window as JPEG or PNG file
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