[SOLVED] Comp 182 Project 2

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (2 votes)

Problem: Determine the amount of customer delay when there are n check-out lines.
Requirements: You must submit the following Java classes to Canvas as specified in
this document.
public class Person{//corresponds to a customer
int arrivalTime;
int departureTime;
int processing Time;
}
public class Event{//corresponds to either an arrival or departure
String type; //can be “arrival” or “departure”
int time;//if “arrival”, this will be the arrival time of a job; if “departure”,
//this will be the departure time of a job
int param; if “arrival”, this will be the processing time of a job; if
//“departure”, this will be the checkout line that had a departure event
}
public class PersonQueue{
int totalTime; //the sum of all processing times in this queue
//can use any structure
//because this is a queue, you will need enqueue(), dequeue(), isEmpty()
}
public class EventPQueue{
//because this is a priority queue, you will need enqueue(), dequeue(), isEmpty()
}
public class Store{
PersonQueue[] mypq;
EventPQueue myeq;
int numberOfQueues;//optional
int totalDelay;//optional
// will probably need an add method that adds a Person to the PersonQueue with the
//least number of people
//will probably need a remove method that removes a person from a PersonQueue who
//has finished the checkout process
}
public class Driver{
//contains the main method
//allows the user to provide the following parameters (a)number of check out
//lines, (b) number of persons/customers, (c) min and max time between person
//arrivals, (d) min and //max processing time for a person
//during run time, the time between arrivals and processing times will be randomly
//selected within the user defined ranges
}
You may add methods and additional fields as you see fit.
Sample Output:
Welcome to Job Simulator
How many queues do you want to simulate?
> 2
How many customers do you want to simulate?
> 5
What is the minimum time between job arrivals?
> 2
What is the maximum time between job arrivals?
> 5
What is the minimum processing time for a job?
> 6
What is the maximum processing time for a job?
> 8
Time Activity
0 Customer Arrives (processing time 7) – Customer Joins Queue 1
2 Customer Arrives (processing time 8) – Customer Joins Queue 2
5 Customer Arrives (processing time 8) – Customer Joins Queue 1
7 Customer Departs Queue 1
9 Customer Arrives (processing time 8) – Customer Joins Queue 1
10 Customer Departs Queue 2
12 Customer Arrives (processing time 6) – Customer Joins Queue 2
15 Customer Departs Queue 1
18 Customer Departs Queue 2
23 Customer Departs Queue 1
Total Delay: 8

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.