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

  Use active directory to establish security group memberships

How would you manage creation of novel user accounts in this organization? Utilizing Active Directory to establish security group memberships or manual creation and security.

  Discuss the concept of phase shift in oscillators

Discuss the concept of phase shift in oscillators and how it is controlled in oscillator circuits.

  Use the internet to visit its web page and find a listing

For what kind of information security jobs does the NSA recruit? Use the internet to visit its Web page and find a listing.

  What are some factors or requirements

What are some factors or requirements when designing an Active Directory Infrastructure. How do you gather the requirements for the design? Please explain in approximately in two paragraphs.

  Protect proprietary interest by addressing ethical issues

Advise whether you agree or disagree with CEO, specifically addressing ethical issues involved. Suppose you make a decision to hire a hacker, how would you protect your proprietary interests?

  Determine present worth-future worth of soldering machine

The initial cost is in week 0 and the payments are in years 1-4. Determine the present worth, future worth, and annual worth for.

  Give cfg for the following language

Give CFG for the language L={x %u03F5 {0,1}*/x has unequal number of 0's and 1's}

  Write program that reads length and width of a rectangular

Write a program that reads in the length and width of a rectangular yard (in meters) and the length and width of a rectangular house (in meters) placed in the yard.

  Apply the dynamic programming algorithm

Apply the dynamic programming algorithm to find all the solutions to the change-making problem for the denominations 1, 3, 5 and the amount n = 9

  Provide an explanation of hashtables

Provide an explanation of hashtables, including a description of a realistic scenario that could be solved with the application of a hashtable

  Describe history of portfolio design in graphics design

Describe the history of portfolio design in the graphics design industry, and role of a graphic designer. Discuss current trends in portfolio design, and the possible future technologies for the industry.

  Methods-majority of target audience can play applications

What are some methods that we can guarantee that majority of target audience can play applications?

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