Write the code of the main part of the program

Assignment Help Basic Computer Science
Reference no: EM13306462

In many Olympic competitions such as high jump, athletes wait in a line to show their skills. Let us emulate this line. Your simulation will simulate a 20 minutes interval. Each high jump may require several attempts, so it takes between 1 and 3 minutes to complete. New competitors arrive over time, with some randomness. In your simulation, the number of new competitors that arrive on each time step will vary between 0 and 1. To execute the simulation, at each moment of time, perform the following steps: Generate new competitors and add them to the queue. First, generate a random number (using Math.random()) between 0 and 1 to see how many competitors to add. If one competitor was selected, generate a random num- ber between 1 and 3 for each competitor to determine how many minutes this competitor will take. Enqueue this number. For the competitor at the head of the queue { the one who is jumping right now { decrement the number of minutes by 1. If the value becomes 0, this indicates that the competitor nished jumping. In this case, remove this competitor from the queue (if the queue was empty, it remains empty). We are interested in two important values: the average length of the queue of competitors, and the maximum length of the queue. Your program should compute these values. Repeat simulations 100 times and compute the average and maximum over all these simulations. Write the code of the main part of the program so that the code only uses the operations enqueue, dequeue, size, and isEmpty. Then, show that your program works with both types of queue implementation { as a linked list and as an array.

Reference no: EM13306462

Questions Cloud

Find which is less than the maximum taxable wage base : Find an equation that expresses the relationship between the wages earned (x) and the Social Security taxes paid (y) by an employee who earns less than the maximum taxable wage base.
What is the pressure exerted on the wall : In a period of 9.00 s, 9.40x1023 nitrogen molecules strike a section of a wall with an area of 2.00 cm2. what is the pressure exerted on the wall
List uses that this type of computer could support : List uses that this type of computer could support for whichever division selected from above.Explain why you think the impact will or will not occur, cite sources when necessary, and justify your position using APA format.
Find the height of its fall : An object falls from a height h from rest. If it travels a fraction of the total height of 0.6995 in the last 1.00 s, Find the height of its fall
Write the code of the main part of the program : Write the code of the main part of the program so that the code only uses the operations enqueue, dequeue, size, and isEmpty. Then, show that your program works with both types of queue implementation { as a linked list and as an array.
Manufacturing facilities in philadelphia : Dracca, Inc. ("Dracca") is a publicly-traded U.S. corporation that manufactures and distributes baby equipment in seven countries.  It is based in St. Louis, MO, but has manufacturing facilities in Philadelphia, Sacramento, and Indonesia.
Thailand political and economic risks : Land ownership systems initially were indifferent not allowing Non Thais to purchase land in the country unless such land is on the government approved industrial estates
Create a new string to represent the corresponding full name : Create a new string to represent the corresponding full name, and display it on screen in format: Lastname, Firstname, Middle name.
Determine the maximum temperature of the water : The highest recorded waterfall in the world is found at Angel Falls in Venezuela. Its longest single waterfall has a height of 807 m. what is the maximum temperature of the water at the bottom of the falls

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifying and describing how information is used

Write a 700- to 1,050-word paper identifying and describing how information is used and how it flows in an organization.

  Explain how data and information can be categorised

What is meant by data? What is meant by information? How can data information be categorised? Where from? Used for?

  Write a function called circlearea

Write a function called circleArea.

  Decryption algorithm: reverse the encryption algorithm

Decryption algorithm: Reverse the encryption algorithm. The permutation, however, should (circular) shift the bit pattern by 1 bit to the right

  Analyze the data to make business decisions

Database reports give us with ability to further analyze the data and give it in format which can be used to make business decisions.

  How to make components of system user-friendly

How do components of your computer system interact within system? What improvements or additions to your system do you think would benefit you or make system more user-friendly? Why?

  Create a japplet that contains a jlabel and jbutton.

Create a JApplet that contains a JLabel and JButton. You'll create a JButton that will automatically change font typeface, style, and size when clicked by the user. Change the font typeface, style, and size on the JLabel.

  Briefly describe what the notion

Briefly describe what the notion of "normal operation" means to an executing computer program

  Pseudocode or code for simple task

Then post pseudocode or code you would write for simple task (making peanut butter sandwich, for example) as well as three simple control structures that could be used to create this algorithm

  What makes a good proposal

Persuade the reader that the proposers (you) are qualified for the work, have a plausible plan and have the resources needed to complete the task.

  Write an appropriate me expression capturing the essence

Write an appropriate ME expression capturing the essence

  Create a console-based program and a gui application

create a console-based program and a GUI application, which justifies the following conditions: The Main() method prompts the user for an integer value and, in turn, passes the value to a method that squares the number and a method that cubes the ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd