Question: 2. Tasks Write a Java application called HiringApp that you will use to hire and fire (actually meant layoff) IT workers for a company.

2. Tasks Write a Java application called HiringApp that you will useto hire and fire (actually meant layoff) IT workers for a company.The rules of hiring and firing are described as follows: 1) Ifyou are asked to fire somebody at a time when the firm

2. Tasks Write a Java application called HiringApp that you will use to hire and fire (actually meant layoff) IT workers for a company. The rules of hiring and firing are described as follows: 1) If you are asked to fire somebody at a time when the firm has no employees, you must notify your supervisor by printing a related message. 2) If you are asked to fire somebody when the firm has 1 or more employees, you must fire the most recently hired (i.e. based on seniority). In another word, the least senior employee gets fired first. 3) You are to keep a list of applicants and the order in which they applied job positions. 4) When you are asked to hire someone, if anybody has been fired, the most recently fired ex-employee must be re-hired before any applicant. Ex-employees don't need to apply for the jobs when they are re-hired. So ex- 5) employees are not applicants. In another word, ex-employees are preferred over applicants during hiring. If there is nobody who has been fired, then the person who applied earliest is to be hired. 6) If there is nobody available for hiring, then you must notify your supervisor by printing a related message. 7) For simplicity, it is assumed that no employee voluntarily leaves the company. The program should have a simple menu that allows you to specify these actions: Accept an application Hire Fire Quit "Accept an application" should prompt and get the information of an applicant from the user and add that person's information to an appropriate data structure. "Hire" should choose the appropriate person to hire based on the hiring rule above, print the information of the person who is hired, and appropriately update the internal data structures. "Fire" should choose the appropriate person to fire based on the firing rule above, print the information of the person who is fired, and appropriately update the internal data structures. "Quit" should exit the program. An applicant or an employee is represented by the full name, degree, and a list of skills. 3. Coding Requirements Your programs MUST have two classes: Person class Represent an applicant or an employee (current employee or past employee) Include the following data fields and methods: HiringApp class Data fields: name, degree, skills (like Java, C#, etc.) The skills MUST be represented using an ArrayList or LinkedList. A constructor that creates an object with the given name, degree, and skill list. Getters and setters for all data fields String toString() Returns a string containing all information about this Person The Java Application class that implements the hiring and firing rules described above. The class must use Person class to represent applicants and employees You must get the applicant's information (name, degree, skill list) from the user. You must implement the menu described above. You must use the appropriate data structures to represent different groups of people and implement the hiring and firing logic described above. Applicants - People who applied and are waiting to be hired. Current employees - People who were hired based on the hiring rule. Past employees - People who were fired based on the firing rule. NOTE: Since stack and queue are special cases of list. If stack or queue is a more appropriate data structure than just plain list, then you must choose to use stack or queue instead of list. If you don't, you will get partial credit, but not 100% credit. 4. Coding Hints Decide on What Data Structures for Applicants and Employees who were hired or fired Before you start programming, you need to decide which data structures are appropriate for storing the people involved in this HiringApp. The appropriate data structures will be two out of the following three types: List - an indexed collection of items. An item can be accessed from any position in the list. Stack - a list of items that must be accessed only from one end in a First In Last Out manner. The top of the stack is the most recently added data item. Queue - a list of items that must be accessed in a FIRST IN FIRST OUT manner. In another word, items must be added to the tail of the queue, and viewed/removed from the front of the queue. The front of the queue is the least recently added data item. The tail of the queue is the most recently added data item. Completion Order First complete Person class. Then complete HiringApp class. Coding Template A coding template is given to you in the Java package: assign4_template. Related Lecture Code for Reference: For how to use ArrayDeque or LinkedList as a Stack, . . o check the programs in the java package stack_app. In particular, the program SimpleArrayStackTest.java. For how to use ArrayDeque or LinkedList as a Queue, o check the programs in the java package: queue_app. In particular, the programs SimpleArrayQueueTest.java, SimpleLinkedQueueTest.java To refresh your skill of using ArrayList, check the programs in the java package arraylist. In particular, the program ArrayListTest.java. For the menu handling in HiringApp, Refer to what you did in previous assignments. You can also refer to the program MaintainQueue.java in the java package queue_app if you did not manage the menu correctly in the previously. Modularize Code in HiringApp Remember to modularize the code in HiringApp. Split the code into multiple smaller methods. Do NOT use a GIANT main() method. Related Data Structures in Java API Queue interface: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Queue.html Deque interface https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Deque.html ArrayDeque class https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ArrayDeque.html LinkedList class https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/LinkedList.html ArrayList class o https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ArrayList.html 5. Sample Output: Note: means the user hits Return key on the keyboard. Action (1 to accept, 2 to hire, 3 to fire): 3) Memo to supervisor: There is nobody to fire Action (1 to accept, 2 to hire, 3 to fire): 12 Enter the applicant's name, degree: Fred Bachelor Enter the number of skills and the skill list: 1 Java Action (1 to accept, 2 to hire, 3 to fire): 12 Enter the applicant's name, degree: Barney Bachelor Enter the number of skills and the skill list: 2 Java C++ 2) Action (1 to accept, 2 to hire, 3 to fire): 1 2 Enter the applicant's name, degree: Bambam Master Enter the number of skills and the skill list: 3 Java C# Python Action (1 to accept, 2 to hire, 3 to fire): 22 Fred hired Action (1 to accept, 2 to hire, 3 to fire): 2 Barney hired Action (1 to accept, 2 to hire, 3 to fire): 32 Barney fired Action (1 to accept, 2 to hire, 3 to fire): 2 Barney hired Action (1 to accept, 2 to hire, 3 to fire): 2 2 Bambam hired Action (1 to accept, 2 to hire, 3 to fire): 2 2 Memo to Supervisor: There is nobody to hire

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer HiringAppjava package example import javautilArrayDeque import javautilQueue import javautilDeque import javautilArrayList import javautilLinkedList import javautilScanner public class HiringAp... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!