Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA. explain with comments can i get RepairMan and Main class please, when creating a thread just name it as its created instead of hard

JAVA. explain with comments

can i get RepairMan and Main class please, when creating a thread just name it as its created instead of hard coding it in later on

any help at all would be great!

Write a program that uses ArrayBlockingQueue to simulate processing issues in a laptop repair workshop. After an Assistant receives a laptop with an issue, a RepairMan fixes it. Make sure to include some delay between receiving and fixing issues. The program should include three classes Assistant, RepairMan and Main. Assistant receives the laptops with issues, Repairman class is for fixing the issues and Main class is for creating threads. In the Main class, creates 3 Assistant threads Assistant Aoife, Assistant Katie, and Assistant Mark, and 2 RepairMan threads RepairMan Andrew and RepairMan Emily. Print out the process while each thread is running see example 1. Each order should only be received and fixed once. After all threads finish running, print out the number of issues received by each Assistant and fixed by each RepairMan see example 2. Receiving and repairing issues are based on FIFO. The issue list that the Assistant needs to receive is attached as issueList.txt The following examples are samples of how the result may look like.

Creating classes correctly 2 point

Thread Creation 2 points

Reading input file correctly 2 points

Using Locking/Synchronising threads 4 points

FIFO queue successfully implemented 2 points

Correct results output 2 points

Example 1:

Assistant Mark is receiving Battery Issue92 RepairMan Emily is fixing Battery Issue92 Assistant John is receiving Screen Cracked 93 RepairMan Emily is fixing Screen Cracked 93 Assistant Mark is receiving Screen Cracked 94 RepairMan Emily is fixing Screen Cracked 94 Assistant John is receiving Battery Issue95 RepairMan Emily is fixing Battery Issue95 Assistant Mark is receiving Screen Cracked 96 RepairMan Emily is fixing Screen Cracked 96 Assistant Mark is receiving Battery Issue97 RepairMan Emily is fixing Battery Issue97 Assistant John is receiving Battery Issue98 RepairMan Emily is fixing Battery Issue98 Assistant John is receiving Screen Cracked 99 RepairMan Andrew is fixing Screen Cracked 99 Assistant John is receiving Battery Issue100 RepairMan Andrew is fixing Battery Issue100

Example 2:

Assistant John finished receiving 33 orders including 11 battery issues, 15 screen cracks and 7 keyboard issues

Assistant Mark finished receiving 34 orders including 13 battery issues, 8 screen cracks and 12 keyboard issues

Assistant Katie finished fixing total 33 orders including 12 battery issues, 20 screen cracks and 1 keyboard issues

RepairMan Andrew finished fixing 49 orders including 10 battery issues, 10 screen cracks and 29 keyboard issues

RepairMan Emily finished fixing 51 orders including 13 battery issues, 17 screen cracks and 21 keyboard issues

issuesList.txt;

1 Battery Failure 2 Screen Crack 3 Keyboard Issue 4 Battery Failure 5 Screen Crack 6 Keyboard Issue 7 Battery Failure 8 Screen Crack 9 Keyboard Issue 10 Battery Failure 11 Screen Crack 12 Keyboard Issue 13 Battery Failure 14 Screen Crack 15 Keyboard Issue 16 Battery Failure 17 Screen Crack 18 Keyboard Issue 19 Battery Failure 20 Screen Crack 21 Keyboard Issue 22 Battery Failure 23 Screen Crack 24 Keyboard Issue 25 Battery Failure 26 Screen Crack 27 Keyboard Issue 28 Battery Failure 29 Screen Crack 30 Keyboard Issue 31 Battery Failure 32 Screen Crack 33 Keyboard Issue 34 Battery Failure 35 Screen Crack 36 Keyboard Issue 37 Battery Failure 38 Screen Crack 39 Keyboard Issue 40 Battery Failure 41 Screen Crack 42 Keyboard Issue 43 Battery Failure 44 Screen Crack 45 Keyboard Issue 46 Battery Failure 47 Screen Crack 48 Keyboard Issue 49 Battery Failure 50 Screen Crack 51 Keyboard Issue 52 Battery Failure 53 Screen Crack 54 Keyboard Issue 55 Battery Failure 56 Screen Crack 57 Keyboard Issue 58 Battery Failure 59 Screen Crack 60 Keyboard Issue 61 Battery Failure 62 Screen Crack 63 Keyboard Issue 64 Battery Failure 65 Screen Crack 66 Keyboard Issue 67 Battery Failure 68 Screen Crack 69 Keyboard Issue 70 Battery Failure 71 Screen Crack 72 Keyboard Issue 73 Battery Failure 74 Screen Crack 75 Keyboard Issue 76 Battery Failure 77 Screen Crack 78 Keyboard Issue 79 Battery Failure 80 Screen Crack 81 Keyboard Issue 82 Battery Failure 83 Screen Crack 84 Keyboard Issue 85 Battery Failure 86 Screen Crack 87 Keyboard Issue 88 Battery Failure 89 Screen Crack 90 Keyboard Issue 91 Battery Failure 92 Screen Crack 93 Keyboard Issue 94 Battery Failure 95 Screen Crack 96 Keyboard Issue 97 Battery Failure 98 Screen Crack 99 Keyboard Issue 100 Battery Failure

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

6. Vanguard

Answered: 1 week ago