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

  What are the features and define the values for parameters

What are the features you would consider essential if you were designing your perfect amplifier

  Write program asks student''s name and number courses taking

Write a program that asks for a student's name and number of courses he is taking. Using a loop, ask for the name of each of the courses.

  Draw and name a one-dimensional array

Draw and name a one-dimensional array that would hold 10 temperatures. Number the elements. I am supposed to finish those 1 to 6 questions for my assignment. please help me.

  Computing characters are there in encyclopedia

The text of the Encyclopedia Britannica is about 44 million words. For a sample of about 2000 words, the average word length was 6.1 characters per word. Approximately how many characters are there in the encyclopedia?

  Event drive programming

Lets look at event drive programming. What is an event driven program? What are events associated with? What are examples of common events?

  Procedural structure of a simple inventory-accounting system

Using a structure chart, recognize the procedural structure of a simple inventory/accounting system for a small store (perhaps a rivately owned curio shop in a resort community)

  Statistics about the numbers read

Write a function whose job is to input #'s, non-# to quit, recover from the input failure by calling recover(), and tell main some statistics about the numbers read. . unsigned readA();

  Write a console program

Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two-dimension array where the first dimension contains exactly what they type an..

  To perform queries

To perform queries on a relational database system using SQL? To demonstrate an advanced knowledge of stored procedures, stored functions and triggers.

  Write java code for your hello/loop

Write java code for your hello/loop

  Find out the number of candidate keys

A relation R(ABCDEF) and functional dependency set F={AB->CDEF ,F->C,C->A,B->D,D->E,F->B}. Find out the number of candidate keys

  Using and tags browser made to repeat sections true,false

By using the and tags, the browser can be made to repeat those sections in a table that spans multiple pages. True False

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