Write a constructor for a class Event; the instances of this class…

Question Answered step-by-step Write a constructor for a class Event; the instances of this class…  Write   a constructor for a class Event; the instances of this class will be used torepresent simulation events. Each instance should have properties time (assumethat this is a Number) and type (of arbitrary type). Your constructor should havetwo arguments corresponding to these properties, so that the properties can beinitialized easily when an instance is constructed.(b) Write   a constructor and methods for a class EventQueue representing an eventqueue. There should be a method empty() that returns true if and only if the queueis empty; a method add() that takes an Event object as its argument and adds itto the queue; and a method removeNextEvent() that removes the Event with thesmallest time value (breaking ties arbitrarily) from the event queue and returns thisobject.(c) Use the classes of (a) and (b) to write   a simple airline ticket counter simulation.Input the number of ticket agents working at the counter. The event queue shouldbe initialized by adding a number of customer-arrival events at various times, eachtime being an integer representing the number of minutes since the ticket counteropened. The program should then begin processing the event queue by removingthe first event. If no agent is free when a customer-arrival event occurs, an elementcontaining the current time should be pushed onto a data structure representing thewaiting line at the ticket counter (so each element of the line structure representsa customer by the time at which the customer entered the line). If an agent is freewhen a customer-arrival event occurs, then the number of busy agents is incrementedand a transaction-complete event is scheduled to occur three minutes later. When atransaction-complete event occurs, if any customers are in the waiting-line structure,then the first customer is removed from the line and the length of time that customerwaited in line is added to an accumulator variable; the number of busy agents isunchanged. Otherwise, if no customers are waiting, an agent becomes free. Thesimulation ends when no events remain in the event queue. At this time, averagecustomer wait time (accumulated wait time divided by number of customers) isoutput.4.21. Write   a JavaScript program that will allow a user to test the speed at which alert boxesare generated by a particular browser running on a particular system. Specifically, theprogram will display an alert box, then display a second alert box after OK is clickedin the first alert box, display a third alert box when the second is acknowledged, andso on. The program will stop displaying these alert boxes once 10 seconds has elapsedfrom the time the first box was displayed (so dividing by 10 will give the number ofboxes displayed per second). Then, for 2 seconds, the program should repeatedly displayalert boxes that report on the number of clicks per second recorded during the first 10seconds (the reason for doing this for 2 seconds is so that you can see the results evenif you accidentally click OK on one or more of the result alert boxes). For timing, useonly the built-in Date object and its methods; that is, don’t use any other timing-relatedhost objects that might be available in your browser. Report on the results of testing withvarious browsers and systems.   Image transcription text4. Interpolation and Integration.Consider the following table of values X0 1 2 f(x) -3 1 2 (a) Without … Show more… Show more    Image transcription textReduction 4. Consider the followingchain of polynomial reductions: 3SAT ,k – Clique p k – Vertex Cov… Show more… Show more  Computer Science Engineering & Technology Networking COMPSCI S897 Share QuestionEmailCopy link Comments (0)