[Solved] CMSC204-Lab 11- Thread Lab

$25

File Name: CMSC204-Lab_11-_Thread_Lab.zip
File Size: 244.92 KB

SKU: [Solved] CMSC204-Lab 11- Thread Lab Category: Tag:
5/5 - (1 vote)

Thread Lab

Start with the Car, CarPanel and CarFrame provided.

Add a CarQueue class that maintains a queue of random directions that the car should go.

  1. There is an addToQueue method that has a class that implements runnable, define the run method (add random directions into the queue and then sleep), creates an instance of the runnable object, creates a thread and starts the thread.

/** Adds 0,1,2 or 3 to queue

* 0 = up

* 1 = down

* 2 = right

* 3 = left

*/

  1. It also has a deleteQueue method that returns an Integer;
  1. In your constructor, place 5 or 6 numbers in the queue so that when the animation starts there will be something to retrieve from the queue

Modify the run method of the startAnimation in CarPanel so that the car will go to the right, left, up or down depending on what is retrieved from the CarQueue. The cars should go in the opposite direction if they hit a boundary.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CMSC204-Lab 11- Thread Lab
$25