Question
After learning about the Stack Abstract Data Type (ADT), you are asked by the computer science department to help them manage the large fluctuations in
After learning about the Stack Abstract Data Type (ADT), you are asked by the computer science department to help them manage the large fluctuations in their student enrollment. If enrollment goes up then more professors will be added to teach these classes, but if enrollment goes down these professors or even existing professors will be removed because there simply are not enough students for those professors to teach. The computer science department decides to value experienced professors over those with less experience. The most recent professor to be added will be the one that is removed first if the enrollment were to drop unexpectedly. The Stack ADT is a perfect representation when you want to remove professors that have been most recently added to the department. The Person class can be created to represent people at the college and this class should have a name instance variable. The Employee class can inherit from the Person class and should have an employee id instance variable. Finally, the Faculty class can inherit from the Employee class and should have a department instance variable. These classes should override the toString method and the equals method from the Object class. These classes should also have accessor and mutator methods for each instance variable because each instance variable should be private. After developing the classes to represent the people at the college, you can reuse the following classes or interfaces: StackInterface, StackFullException, StackEmptyException, and ArrayBasedStack. It should be noted that you are asked by the computer science to also allow a user to view all faculty members of the computer science department from newest to oldest in terms of time with the college. This functionality should be written into the toString method of the ArrayBasedStack class which overrides the definition it receives from the Object class. If the stack is empty then this method will return an empty string. The computer science department would also like to be able to see the list in the reverse order from oldest to newest in terms of time with the college. This functionality should be added to the StackInterface as the following method heading: public String toString2(); //returns the items in the stack from the bottom up which means that the first item added to stack //will be the first item returned and the second item added will be second one returned and so on //if the stack is empty this method will return an empty string Since this method heading has been added to the StackInterface, this means that this method must be implemented by the ArrayBasedStack class. Finally, you have to develop a new Demo class which will serve as the program that the computer science department can use to manage their professors. This demo should give the user options to add a new professor if enrollment goes up, remove the most recent professor if enrollment goes down, look at the most recent professor added, look at all the professors from newest to oldest in terms of time with the college, and finally look at all professors from oldest to newest in terms of time with the college. This program should continue until the user chooses the final option of ending the program.
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