2. Tasks Write a Java application called HiringApp that you will use to hire and fire...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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 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 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) • 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 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
Expert Answer:
Answer rating: 100% (QA)
Answer HiringAppjava package example import javautilArrayDeque import javautilQueue import javautilDeque import javautilArrayList import javautilLinkedList import javautilScanner public class HiringAp... View the full answer
Related Book For
Basic Marketing Research
ISBN: 978-1133188544
8th edition
Authors: Tom J. Brown, Tracy A. Suter, Gilbert A. Churchill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
A beverage wholesale outlet sells beverages by the case. On April 13, a customer purchased 18 cases of wine at $42 per case, 20 cases of soda at $29 per case, and 45 cases of water at $17 per case....
-
Jamieson and Romer (2008) evaluated children's beliefs concerning life expectancy in a diverse sample of American children. In their study, they reported at a 95% CI that "approximately 1 out of...
-
School organizations raise money by selling candy door-to-door. When the price is $1 a school organization sells 2765 candies and when the price goes up to $1.25 the quantity of candy sold drops down...
-
Refer to the information in Exercise 17-7 to answer the following requirements. Required 1. Using ABC, compute the overhead cost per unit for each product line. 2. Determine the total cost per unit...
-
Sales for the past 12 months at Dalworth Company are given here. a. Use a three month moving average to forecast the sales for the months May through December. b. Use a four-month moving average to...
-
Suppose that farmers have a mandatory demand expansion program where all farmers pay a certain amount to fund a promotion program. You have estimated the following market supply and demand functions...
-
Consumer advocates argue that consumers are entitled to five core rights. What are the five core rights? Which one in most important to you and why?
-
You borrow $ 4 5 0 0 0 0 for your new house and your loan period is 1 5 years. Interest rate is 3 % compounded monthly. What is the outstanding balance after the third year?
-
For the current year, The Echo Company possessed the following income: Profit from operations = $110,000 Dividends from 20%-owned taxable domestic operation = $1,100 In the Echo Company's current...
-
Provide an example in which managerial decision making has positively or negatively affected you? How did the personal decision-making styles used by managers apply to the situation? What is your...
-
29 Find dy ty if y = ln [3x+2] dx 1/4
-
ABC manufactures a product with the following: Direct materials standard 5 units at $4 per unit Direct manufacturing labor standard 15 hours at $20 per hour During the second quarter, the company...
-
1: Data definitions and Input-Output functions Write a program that stores the mark allocation weights for 4 assessments as shown in the table below in an array. The program must prompt the user to...
-
Read Case Study Google: Dont Be Evil Unless and answer the following: Why do you think Google was adamant about not wanting to supply information requested by the government concerning the Child...
-
In presenting a report to a group of grocery store managers, a researcher stated the following: "The data from the judgment sample of ten grocery stores were analyzed, and the results show that the...
-
The internet has changed the nature and availability of information that managers can use to make decisions. Consider the opportunities and the challenges of online research compared with a...
-
Make the necessary corrections to the above questions. a. Which of the following magazines do you read regularly? Time Fortune Bloomberg Businessweek b. Are you a frequent purchaser of Great Value...
-
Is Fairmont in compliance with company policy that requires explicit approval of all hours of eighty hours or more.
-
d that Fairmont is not in complianThe forensic audit has determinece with Federal withholding requirements for FICA and Medicare because FICA and Medicare were not withheld from employee paychecks...
-
Which of the following is not a technique to conceal inventory shrinkage? 1. Counting and valuing the physical inventory at the end of each year 2. Writing off inventory after physical inventory...
Study smarter with the SolutionInn App