Question: THIS IS A JAVA CODE Assignment Description: You are asked to write a program that simulates processing documents in some imaginary legal office. This process
THIS IS A JAVA CODE
Assignment Description: 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 IDs. 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 IDs, 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; // 1 or 2 representing officers
int priority; // 1-size of documents based on user input
// randomly generated, lower the number,
// higher the priority int timeStamp;
// 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 1, etc.
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 1s followed by Clerk 2s 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 programs output:
Please enter the number of documents: 50
Documents original list:
TimeStamp 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 ID Priority 3 1 1 . . . . . . //other data 0 1 23 . . . . . . //other data 49 1 50 Clerk #2: TimeStamp ID Priority 1 2 8 2 2 41 . . . . . . //other data 48 2 35 You may download the codes for the data structures you have chosen form the following website:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
