Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me trouble shoot!!! Here is my code...I keep getting one error and I tried adding a ? in between the but nothing works.

Please help me trouble shoot!!!

Here is my code...I keep getting one error and I tried adding a ? in between the but nothing works.

Here is a screenshot of all my classes and a pasted version of each code

So, here are screen shots of my program on Dr. Java. I have highlighted the error:

HELP!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

THANKS

0 J C:\Users\dogpig OneDrive\EXCELSIOR COLLEGE\EXCELSIOR UNIVERSITY IT360\Office.java Eile Edit Tools Project Debugger Language Level Help New Save Close * Cut D Copy Paste Redo Undo 46 Find Compile Reset Run Test Javados import java.util.concurrent. ArrayBlockingQueue; import java.util.concurrent. Blockingueue: InsObject.java Office.java Professor Java Student.java Student Scheduler.java public class Office public static void main(String[] args) { // ArrayBlock size=5 (number of office chairs) Blockingqueue Student> sharedQueue = new ArrayBlockingQueuek>(5); // Professor and Student Scheduler instance creation Student Scheduler studentScheduler = new Student Scheduler (sharedQueue); Professor professor - new Professor (sharedQueue); // set thread priority student Scheduler.setPriority (Thread.MAX_PRIORITY); professor.setPriority (Thread. HAX_PRIORITY); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 // start threads student Scheduler.start(); professor.start(): try { 1/ studentScheduler thread completion standby student Scheduler.join(); // professor thread completion standby professor.join(); // if student Scheduler thread not active, print exit message 10 (!student Scheduler. 1sAlive()) { Systen.out.println("Professor has locked up and left the building..."); } } catch (InterruptedException err) ( err.printStackTrace(); ) } ) 39 Interactions Console Compiler Output 1 error found: File: C:\Users\dogpig OneDrive\EXCELSIOR COLLEGE\EXCELSIOR UNIVERSITY IT360\office.java [line: 7] Error: Syntax error on token " Undo Redo 46 Find Compile Reset Run Test Javadoc 1 import java.util.concurrent.*; 2 InsObject.java Office.java Professor.java Student.java Student Scheduler.java 3 4 5 6 7 8 9 class InsObject ( // insert Student object into queue public void insert (BlockingQueue Student> sharedQueue) { for (int i=0; i sharedQueue) { this.shared(ueue = shared(ueue; ) // run() method public void run() { try // declare variables Student student: Boolean flag - Boolean. TRUE; int recObject = 0; 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 // shared queue message consumption while (true) ( // if Student queue empty and bool-true, professor plays Halo... // even though Battlefield is more fun 10 (sharedQueue. 1sEmpty() sa tlag -- Boolean. TRUE) System.out.println("Professor starts playing Halo..."); flag = Boolean. FALSE; ) else { // renove Student fron queue; add to receiving object student - sharedQueue. take(); recObject; Systen.out.println("Professor starts meeting with " + student.getStudName()); sleep student.getTinerAnt()); flag - Boolean. TRUE; } if (recobject == 301) break; 3 1 1 catch (InterruptedException err) { err.printStackTrace(): 40 41 42 43 44 45 } } Interactions Console Compiler Output 1 error found: File: C:\Users\dogpig OneDrive\EXCELSIOR COLLEGE\EXCELSIOR UNIVERSITY IT360 office.java [line: 71 Error: Syntax error on token " sharedoueue: // InsObject class object InsObject insObject = new InsObject(); // Student Scheduler constructor public Student Scheduler BlockingQueue Student> sharedQueue) { super(); this.sharedQueue = sharedQueue; } } // run() method at start of thread public void run() ( // synchronize insobject with synchronized block synchronized insObject) insObject.insert(sharedQueue); } 1 ) 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 Interactions Console Compiler Output 1 error found: File: C:\Users\dogpig\OneDrive\EXCELSIOR COLLEGE\EXCELSIOR UNIVERSITY IT360\Office.java [line: 71 Error: Syntax error on token "

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: 3

blur-text-image

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

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

denigration of emotional outbursts; being reserved;

Answered: 1 week ago