Menu

Use Java Programming Following Questions Solutions Ready Within Today Jan 3 2020 7 00pm Gm Q43785290

Use java programming for the following questions to have thesolutions ready within today Jan 3 2020 at or before 7:00PM GMT+8time zone:

Question 14

Discrete event simulation is tosimulate events occurring at discrete time points. Between any twoconsecutive time points, no event occurs.

  1. Write a class Event with two integer instance variable time andtype, which represents an event of a specific type occurs at time.Also write the constructor Event(int time, int type), whichinitializes the attributes using the parameters. In using thisclass, you can assume the getter and setter methods areavailable.
  1. Write a class Bank with an attribute eventList, which is alist of Event. Add a method generateEvents(int n)which generates n random customer arrival events (with event type0) and put them into eventList in the order of increasing arrivaltimes. The arrival time of the first customer is a random integerbetween 0 to 10 (inclusively). Similarly, after the first customerhas arrived, the time to wait for the next customer to arrive, theinterarrival time, is also a random integer between 0 to 10. Otherfuture customer arrivals are similar. For example, if the firstcustomer arrives at 3 and the next 2 interarrival times are 2 and4, the actual customer arrival times are 3, 5 (=3+2) and 9(=5+4).
  1. Write a method waitingTime(int serviceTime) of Bank whichreturns the average waiting time of the customers whose arrivaltimes are in eventList, where serviceTime is the time each customerbeing served at the bank counter. In other words, the servicingtime of each customer is the same.

Expert Answer


Answer to Use java programming for the following questions to have the solutions ready within today Jan 3 2020 at or before 7:00PM…

OR