Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java class that implements a discrete event simulator. The simulator should have a method with the following prototype: void simulate(double time), that simulates

Write a Java class that implements a discrete event simulator. The simulator should have a method with the following prototype: void simulate(double time), that simulates the arrival and execution of requests at a generic server for time milliseconds, where time is passed as a parameter to the method. The class should be implemented in its own java file, named simulator.java. The simulator class will internally use a exponentially-distributed random number generator.

Apart from implementing the simulate(...) method, the class should also include a main(...) function. The main(...) function should accept 3 parameters from the calling environment (in the following order):

(a) length of simulation time in milliseconds. This should be passed directly as the time parameter to the simulate(...) function.

(b) average arrival rate of requests, expressed as requests per millisecond;

(c) average service time at the server, expressed in milliseconds; It is responsibility of the main(...) function to internally invoke the implemented simulate(...) function only once.

In this first version, the simulate(...) function will need to print in the console the simulated time at which each request arrives at the system (ARR), initiates service (START), and completes service (DONE).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

Students also viewed these Databases questions

Question

What are the four main financial objectives of a firm?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago