Solve this java programming assignment Coding Assignment: In this problem you will develop code to simulate a
Fantastic news! We've Found the answer you've been seeking!
Question:
Solve this java programming assignment
Transcribed Image Text:
Coding Assignment: In this problem you will develop code to simulate a dual-class queuing system with traffic loopback. The server you simualate accepts requests from two classes of users that send requests with different parameters. Moreover, once a request leaves the server, it might leave the system or go back and ask for more service. The additional amount of service time is distributed in the same was as the originally requested amount. After that, the request might go out or loop back in and so on. Request service times at all the servers are modeled using an exponential distribution, while the arrival process of all the requests follows a Poisson distribution (Hint: recall that if an arrival process is Poissonian, then the inter-arrival time between requests is exponentially distributed). a) Extend your Simulator class to be able to handle two independent streams of requests, of class X and Y, respectively. The Server should still be used to enqueue and process arriving requests following a given policy FIFO or Shortest Job Next (SJN). Once again, you are free to take any implementation choice that allows the simulator to correctly handle the simulated traffic and service policies. For this part, still assume that once a request has completed processing at the server, it leaves the system immediately. Like before, 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, a timeline and two load generators. For these, you can re-use/adapt the classes you wrote as part of the previous assignment. Please be mindful of the capitalization in all the files you submit. Apart from implementing the simulate (...) method, the class should also include a main (...) function. The main (...) function should accept 6 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 of class X (^x); (c) average arrival rate of requests of class Y (^y); (d) average service time at the server for requests of class X (Tsx); (e) average service time at the server for requests of class Y (Tsy); (f) queuing policy which can either be "FIFO" or "SJN"; (g) probability Pout of leaving the system after completion (set to 1 for this part). 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 of class X or Y arrives at the system (ARR), initiates service (START), and completes service (DONE). To generate a sequence of ARR events with the right inter-timing, reuse the loadGenerator approach from HW1. In this case, you will have two LoadGenerator instances, for class X and Y requests, respectively. When their releaseRequest(...) is called, TWO things happen: (1) just like before, generate the next arrival using λ or Ay; and (2) create a new Request object with length sampled from an exponential distribution with parameter 1/Ts, or 1/Tsy and pass it to the Server. Thus, the Server class should have some receiveRequest(...) method that can be called by the LoadGenerator for this purpose. At the end of the simulation, still print out global statistics for the utilization (UTIL), average system Coding Assignment: In this problem you will develop code to simulate a dual-class queuing system with traffic loopback. The server you simualate accepts requests from two classes of users that send requests with different parameters. Moreover, once a request leaves the server, it might leave the system or go back and ask for more service. The additional amount of service time is distributed in the same was as the originally requested amount. After that, the request might go out or loop back in and so on. Request service times at all the servers are modeled using an exponential distribution, while the arrival process of all the requests follows a Poisson distribution (Hint: recall that if an arrival process is Poissonian, then the inter-arrival time between requests is exponentially distributed). a) Extend your Simulator class to be able to handle two independent streams of requests, of class X and Y, respectively. The Server should still be used to enqueue and process arriving requests following a given policy FIFO or Shortest Job Next (SJN). Once again, you are free to take any implementation choice that allows the simulator to correctly handle the simulated traffic and service policies. For this part, still assume that once a request has completed processing at the server, it leaves the system immediately. Like before, 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, a timeline and two load generators. For these, you can re-use/adapt the classes you wrote as part of the previous assignment. Please be mindful of the capitalization in all the files you submit. Apart from implementing the simulate (...) method, the class should also include a main (...) function. The main (...) function should accept 6 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 of class X (^x); (c) average arrival rate of requests of class Y (^y); (d) average service time at the server for requests of class X (Tsx); (e) average service time at the server for requests of class Y (Tsy); (f) queuing policy which can either be "FIFO" or "SJN"; (g) probability Pout of leaving the system after completion (set to 1 for this part). 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 of class X or Y arrives at the system (ARR), initiates service (START), and completes service (DONE). To generate a sequence of ARR events with the right inter-timing, reuse the loadGenerator approach from HW1. In this case, you will have two LoadGenerator instances, for class X and Y requests, respectively. When their releaseRequest(...) is called, TWO things happen: (1) just like before, generate the next arrival using λ or Ay; and (2) create a new Request object with length sampled from an exponential distribution with parameter 1/Ts, or 1/Tsy and pass it to the Server. Thus, the Server class should have some receiveRequest(...) method that can be called by the LoadGenerator for this purpose. At the end of the simulation, still print out global statistics for the utilization (UTIL), average system
Expert Answer:
Answer rating: 100% (QA)
To tackle this coding assignment youll need to create a Java program with several classes Simulator Server LoadGenerator and Request These classes will interact to simulate the queuing system with tra... View the full answer
Related Book For
Introduction To Quantum Mechanics
ISBN: 9781107189638
3rd Edition
Authors: David J. Griffiths, Darrell F. Schroeter
Posted Date:
Students also viewed these programming questions
-
Thor Co. granted 30,000 share appreciation rights which entitled key employees to receive cash equal to the difference between P20 and the market price of the share on the date each right is...
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Draw the BST that results when you insert the keys E A S Y QUE S T I O N in that order into an initially empty tree. What is the height of the resulting BST?
-
Norlutin® and Enovid® are ketones that suppress ovulation. Consequently, they have been used clinically as contraceptives. For which of these compounds would you expect the infrared carbonyl...
-
In java, write a method(myMethod) that takes an argument of an array [20 random integers between 500], and an int variable (int y), then the return should be T/F depending if y matches an integer in...
-
L.A. Gear, a manufacturer of sports shoes and sportswear, began operations in the early 1980s. By late 1996, however, the company was in bankruptcy. Following are cash flow data for the company for...
-
1. Jonathan was notified by the IRS that he should appear at the local IRS district office with support for his 2012 travel and entertainment expenses as well as his charitable deductions. It was a...
-
E11-7 (Algo) Finding Amounts Missing from the Stockholders' Equity Section [LO 11-2, LO 11-4] The stockholders' equity section on the December 31 balance sheet of Chemfast Corporation reported the...
-
Given VDS = 4 V for the network of Fig. 7.93, determine: a. 1D. b. VD and VS c. VGS 12 V 4 V GS 6-3 V
-
ACCESS the Texas Education Agency Website at www.tea.state.tx.us. At the TEA home page, SELECT F from the A-Z index, then SELECTS the TEAs Financial Accountability System Resource Guide link and OPEN...
-
Velcro Saddles is contemplating the acquisition of Skiers' Airbags Incorporated. The values of the two companies as separate entities are $30 million and $15 million, respectively. Velcro Saddles...
-
12) The spread of the flu virus through a certain population is modeled by y 1000 -0.7t where y is the 1+990e total number infected after t days. In how many days will 350 people be infected with the...
-
Assume 6% bonds could be issued and the proceeds used to refund the existing bonds (i.e.: you issue enough bonds to completely buy back the old bond without the additional use of company cash). What...
-
Office of Government Ethics and its jurisdiction in the application and investigation of the Organic Law on members of the Puerto Rico police force Introduction to the Office of Government Ethics:...
-
what's the benefit for Non-concessional contribution, and how its going. please explain the concessional contribution and non-concessional contribution in details.
-
Briefly Explain Accounting nd taxation with examples and CGT and also Stocks? What is the CGT?
-
a) Calculate the goodwill that was paid by Major Ltd on the acquisition of Minor Ltd. [10 marks] b) Prepare the consolidated statement of financial position for Major Ltd at 31 July 20X8. [30 marks]...
-
As an angular momentum, a particles spin must flip under time reversal (Problem 6.36). The action of time-reversal on a spinor (Section 4.4.1) is in fact so that, in addition to the complex...
-
Because the three-dimensional harmonic oscillator potential (see Equation 4.215) is spherically symmetrical, the Schrdinger equation can also be handled by separation of variables in spherical...
-
Verify Equations 4.175 and 4.176 using the ClebschGordan table. |11) = (10) = -1) = (I)+|)) <4T>} |) S= 1 (triplet). (4.175)
-
Presented below are summary financial data from the Johnson & Johnson 2015 annual report. Using the ratio definitions from Exhibit 4.6, calculate the following ratios: return on equity, return on...
-
Presented below are summary financial data from the Bristol-Myers Squibb 2015 annual report. Using the ratio definitions from Exhibit 4.6, calculate the following liquidity and solvency ratios: cash...
-
Presented below are summary financial data from The Boeing Company 2015 annual report. Using the ratio definitions from Exhibit 4.6, calculate the following ratios: return on equity, return on assets...
Study smarter with the SolutionInn App