Question: I need help with stacks and queues in Java script! You are asked to write a program that simulates processing documents in some imaginary legal
I need help with stacks and queues


in Java script!
You are asked to write a program that simulates processing documents in some imaginary legal office. This process involves a secretary, and two clerks. These clerks process the documents that are labeled based on their ID's. One officer will process their work based on the priority, while the other goes with the exact order the documents were received. The secretary will receive documents and stores them in an array in the exact order of their arrival. The documents will be distributed to the clerks based on the ID's, as well as the pattern each clerk is supposed to process them. You need to pick a data structure for the secretary, as well as each clerk based on the description given here. The document will be represented as a class described below: class Document: Attributes: int ID; int priority; // 1 or 2 representing officers // 1-size of documents based on user input // randomly generated, lower the number, // higher the priority // This will be simply the number of the // object that is instantiated, think of it // as an array index: 0-[size-1]. The first // document will be 0, next will be i, etc. int timestamp; Methods: All the set and get methods. The following is the list of the tasks needed in the main method: Prompt the user for the size of the documents, not exceeding100. We will need to instantiate that many objects of type Document by randomly picking an ID of 1 or 2, and assign a random priority value in the range 1 through the size inputted by the user. We will not worry about the duplicates. Clerk with ID of 1, will be given their list based on the priority of the documents. Pick the proper data structure for this clerk and insert their respective documents in their pile. We assume clerk with the ID of 2 processes their documents based on their order of arrival. Your job here is to pick the right data structure for them, and insert the document that is addressed to them in its proper position. When you are done with this process, the clerks have their data structures populated. As the output, you are required to display the following lists: 1. The list of documents received by the secretary in the exact order they are created. With the first one on top row of the output. 2. Clerk 1's followed by Clerk 2's list of documents with the first document they will access to appear on top row of the respective section of the output. The following is an example of this program's output: Please enter the number of documents: 50 Documents original list: Time Stamp ID Priority 0 1 23 1 2 8 2 2 41 3 1 1 //other data 48 2 35 49 1 50 Clerk #1: TimeStamp 3 ID 1 Priority 1 //other data 23 //other data 50 0 49 Clerk #2: Time Stamp ID 2 2 Priority 8 41 //other data 35 48 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
