Please type out the code. (Don't submit no screenshots) thank you Form a multithreaded program that mimics
Question:
Please type out the code. (Don't submit no screenshots) thank you
Form a multithreaded program that mimics a taxi service (Taxi For You) which has 5 drivers. Customer information is read in from a text file(CustomerList.txt) attached (Delimiter is "yes" while "No" indicates end of file).
Form
a dispatcher program that reads the Customer file for the day and loads the customers into a queue . The dispatcher should create driver threads to serve these customers from the queue. On duty Driver threads should keep picking up customers from the queue. Use sleep to mimic time taken to drop each customer ( Eg:Thread.sleep((long)(Math.random() * 10000));). Drivers can serve a maximum of 4 customers before going offDuty. Find attached the text file CustomerList and Customer.java. Create Dispatcher.java and Driver.java to mimic the dispatcher and drivers. You can add/modify classes as needed. You may use any concurrency mechanisms discussed in class. Using Blocking queues would be the easiest way to accomplish this eg:LinkedBlockingQueue .Send all your files in a zip folder called taxi. Here are snippets of some sample output to give you an idea. Note each run will give a different output depending on your CPU processing. ******************************************************************************************** 2 is on duty. 3 is on duty. 1 is on duty. 5 is on duty. 4 is on duty. Cust#1 has been picked up by driver #2 proceeding from Yorktown Heights to Madison Square Garden (The customercount is 1) Cust#2 has been picked up by driver #3 proceeding from White Plains to Yankee Stadium (The customercount is 1) Cust#3 has been picked up by driver #1 proceeding from Yonkers to MetLife Stadium (The customercount is 1) Cust#4 has been picked up by driver #5 proceeding from Yorktown Heights to Madison Square Garden (The customercount is 1) Cust#5 has been picked up by driver #4 proceeding from White Plains to Yankee Stadium (The customercount is 1) Cust#5 was dropped off at Yankee Stadium by driver #4 Cust#6 has been picked up by driver #4 proceeding from Yonkers to MetLife Stadium (The customercount is 2) Cust#4 was dropped off at Madison Square Garden by driver #5 Cust#7 has been picked up by driver #5 proceeding from Yorktown Heights to Madison Square Garden (The customercount is 2) Cust#1 was dropped off at Madison Square Garden by driver #2 ............................ ............................. Cust#18 has been picked up by driver #4 proceeding from White Plains to Yankee Stadium (The customercount is 4) Cust#18 was dropped off at Yankee Stadium by driver #4 4 is off duty. 4 customers were picked up today.
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill