import java.util.Scanner;
import java.util.*;
class Person {
int arrivalTime;
int departureTime;
int processingTime;
Person (int minArrivalTime, int maxArrivalTime, int minProcessingTime, int maxProcessingTime) {//creates a person
generateArrivalTime(minArrivalTime, maxArrivalTime);
generateProcessingTime(minProcessingTime, maxProcessingTime);
System.out.print("\nCreated person with arrival time " + arrivalTime + " processing time "+ processingTime);
this.departureTime = this.arrivalTime + this.processingTime;
}
private void generateArrivalTime (int minArrivalTime, int maxArrivalTime){
this.arrivalTime = (int)Math.random() * maxArrivalTime + minArrivalTime;
}
private void generateProcessingTime(int minProcessingTime, int maxProcessingTime){
this.processingTime = (int)Math.random() * maxProcessingTime + minProcessingTime;
}
public int getProcessingTime(){
return this.processingTime;
}
public int getArrivalTime(){
return this.arrivalTime;
}
}
class Event {
String type;
int time; //this will be either the arrival or departure
int param; //arrival = processing time, if departure = checkout line that had the departure
}
class PersonQueue {
int totalTime;
int numOfCustomers;
}
class EventPQueue {
}
class Store {
PersonQueue[] mypq; //this is the person queue where I need to add each "Person" into the shortest Person Queue (the amount of PersonQueues (registers) is user defined)
EventPQueue myeq; //Priority Queue puts all events into a priority
int totalNumberOfQueue;
private int numOfCustomers;
Store (int checkoutLines, int numOfCustomers, int minArrivalTime, int maxArrivalTime, int minProcessingTime, int
maxProcessingTime) {
this.numOfCustomers = numOfCustomers;
createPersons(numOfCustomers, minArrivalTime, maxArrivalTime, minProcessingTime, maxProcessingTime); //calls the create Person method
}
void createPersons(int numOfCustomers, int minArrivalTime, int maxArrivalTime, int minProcessingTime, int maxProcessingTime){
for (int i = 0; i < numOfCustomers; i++){
new Person(minArrivalTime, maxArrivalTime, minProcessingTime, maxProcessingTime); //makes a new Person passing along the parameters in order to make its arrival time and departure time
}
}
}
public class Driver {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("\nEnter number of checkout lines: ");
int checkoutLines = input.nextInt(); //amount of Person Queues
System.out.print("\nEnter number of customers: ");
int numOfCustomers = input.nextInt(); //amount of persons needed to be created
System.out.print("\nEnter the min time between arrivals: ");
int minArrivalTime = input.nextInt();
System.out.print("\nEnter the max time between arrivals: ");
int maxArrivalTime = input.nextInt();
System.out.print("\nEnter the min processing time for a person: ");
int minProcessingTime = input.nextInt();
System.out.print("\nEnter the max processing time for a person: ");
int maxProcessingTime = input.nextInt();
Store simulation = new Store(checkoutLines, numOfCustomers, minArrivalTime, maxArrivalTime, minProcessingTime, maxProcessingTime);
}
}