Write a Python function to run a Parking Lot (PL) simulation, called PLSimulation, which takes four...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Python function to run a Parking Lot (PL) simulation, called PLSimulation, which takes four integers as parameters: • The first parameter (minArriving) is the minimum number of cars that can park in the PL during one hour. • The second parameter (maxArriving) is the maximum that can park during one hour. • The third parameter (maxLeaving) is the maximum number of cars that may leave the PL during one hour. • The fourth parameter (hours) is the number of hours to run the simulation. Your function should simulate parking and leaving cars for the specified number of hours. In each hour, the following occurs in this order: 1. A random number of cars arrive, ready to park (between the minimum and maximum). That number is added to a count of the number waiting to park. 2. The maximum number of cars that may leave, allowing the same number of cars to park, so that number is subtracted from the count of the number waiting to park (if there are that many waiting to park). Initially, the number of cars waiting to park is O. To generate a random number of cars each hour, use the randrange function, which takes two integer parameters, and which must be imported from the random module. After the simulation is over, write a report giving the car arrival rate (between the minimum and maximum), the car departure rate, and the number of cars waiting to park after the simulation has run for the specified number of hours (hours). Write a Python function to run a Parking Lot (PL) simulation, called PLSimulation, which takes four integers as parameters: • The first parameter (minArriving) is the minimum number of cars that can park in the PL during one hour. • The second parameter (maxArriving) is the maximum that can park during one hour. • The third parameter (maxLeaving) is the maximum number of cars that may leave the PL during one hour. • The fourth parameter (hours) is the number of hours to run the simulation. Your function should simulate parking and leaving cars for the specified number of hours. In each hour, the following occurs in this order: 1. A random number of cars arrive, ready to park (between the minimum and maximum). That number is added to a count of the number waiting to park. 2. The maximum number of cars that may leave, allowing the same number of cars to park, so that number is subtracted from the count of the number waiting to park (if there are that many waiting to park). Initially, the number of cars waiting to park is O. To generate a random number of cars each hour, use the randrange function, which takes two integer parameters, and which must be imported from the random module. After the simulation is over, write a report giving the car arrival rate (between the minimum and maximum), the car departure rate, and the number of cars waiting to park after the simulation has run for the specified number of hours (hours). Write a Python function to run a Parking Lot (PL) simulation, called PLSimulation, which takes four integers as parameters: • The first parameter (minArriving) is the minimum number of cars that can park in the PL during one hour. • The second parameter (maxArriving) is the maximum that can park during one hour. • The third parameter (maxLeaving) is the maximum number of cars that may leave the PL during one hour. • The fourth parameter (hours) is the number of hours to run the simulation. Your function should simulate parking and leaving cars for the specified number of hours. In each hour, the following occurs in this order: 1. A random number of cars arrive, ready to park (between the minimum and maximum). That number is added to a count of the number waiting to park. 2. The maximum number of cars that may leave, allowing the same number of cars to park, so that number is subtracted from the count of the number waiting to park (if there are that many waiting to park). Initially, the number of cars waiting to park is O. To generate a random number of cars each hour, use the randrange function, which takes two integer parameters, and which must be imported from the random module. After the simulation is over, write a report giving the car arrival rate (between the minimum and maximum), the car departure rate, and the number of cars waiting to park after the simulation has run for the specified number of hours (hours). Write a Python function to run a Parking Lot (PL) simulation, called PLSimulation, which takes four integers as parameters: • The first parameter (minArriving) is the minimum number of cars that can park in the PL during one hour. • The second parameter (maxArriving) is the maximum that can park during one hour. • The third parameter (maxLeaving) is the maximum number of cars that may leave the PL during one hour. • The fourth parameter (hours) is the number of hours to run the simulation. Your function should simulate parking and leaving cars for the specified number of hours. In each hour, the following occurs in this order: 1. A random number of cars arrive, ready to park (between the minimum and maximum). That number is added to a count of the number waiting to park. 2. The maximum number of cars that may leave, allowing the same number of cars to park, so that number is subtracted from the count of the number waiting to park (if there are that many waiting to park). Initially, the number of cars waiting to park is O. To generate a random number of cars each hour, use the randrange function, which takes two integer parameters, and which must be imported from the random module. After the simulation is over, write a report giving the car arrival rate (between the minimum and maximum), the car departure rate, and the number of cars waiting to park after the simulation has run for the specified number of hours (hours).
Expert Answer:
Answer rating: 100% (QA)
import random def PLSimulationminArriving maxArriving maxLeaving hours waitingtopark 0 totalarrivals 0 totaldepartures 0 for hour in range1 hours 1 Step 1 Generate a random number of cars arriving bet... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
Suppose you need $10,000 in 5 years. The interest rate is r=4%. How much money do you need to put today in the bank? The bank offers you an interest rate ofr-5%. But in a possible alternative...
-
how average spending patterns change with age. How can comparing your own spending to average spending patterns help you evaluate your budget?
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
QUESTION-3 (20 PTS): 3. What is a bond? Explain the relationship between bond interest rates and bond yields. Also briefly list the important parameters (variables) in a bond issuance/transaction?
-
(a) What is the wavelength of light that is deviated in the first order through an angle of 13.5 by a transmission grating having 5000 slits/cm? (b) What is the second-order deviation of this...
-
The tower crane is used to hoist a 2-Mg load upward at constant velocity. The 1.5-Mg jib BD and 0.5-Mg jib BC have centers of mass at G 1 and G 2 , respectively. Determine the required mass of the...
-
Consider boiling of water under sea-level conditions in a copper vessel. Calculate and plot the heat flux vs. \(\Delta T\) diagram for water at three different pressures. Show the temperature at the...
-
Burham Manufacturing Inc. sold 8,000 units and recorded sales of $400,000 for the first month of 2012. In making the sales, the company incurred the following costs and expenses. (a) Prepare a CVP...
-
2. A flour company has three factories or supply points (i=1,2,3) and must deliver their product to five customers or demand points (j=1,2,3,4,5). The production capacity at each factory is 50 tons...
-
NNS Hospitals Ltd. is a publicly owned company that owns a chain of hospitals. The Balance Sheet of NNS as of 31/3/2015 is given below: Liabilities and Owners Equity Accounts Payable 120,000 Salaries...
-
Which of the following are true about RPA? A. For security reasons, should never be used in a TPS. B. The robot is configured to complete the same process steps,follow the business rules, and use the...
-
The Ramirez Company's last dividend was $1.75. Ramirez's dividend growth rate is expected to be constant at 25% for 2 years, after which dividends are expected to grow at a rate of 6% forever....
-
The last dividend paid by Wilden Corporation was $4.00. The dividend growth rate is expected to be constant at 1.5% for 2 years, after which dividends are expected to grow at a rate of 8.0% forever....
-
1.The Fleming Company, a food distributor, is considering replacing a filling line at its Oklahoma City warehouse. The existing line was purchased several years ago for $650,000. The line's book...
-
This problem demonstrates the dependence of the present value of an annuity on the discount rate. For an ordinary annuity consisting of 25 annual payments of $1,300, calculate the present value using...
-
Assume that your client invests $1,900 at the end of each of the next two years. The investments earn 4.9% compounded annually. What is the future value at the end of the two years? (Do not round...
-
Art-Labeling Activity: A generalized nephron and collecting system Part A Drag the appropriate labels to their respective targets. Submit Renal corpuscle Proximal Nephron Tubule loop Request Answer...
-
In your readings, there were many examples given for nurturing close family relationships in this ever-evolving technological society we live in Based upon your readings and research describe three...
-
In her will, Teressa granted a life estate to Amos in certain real estate, with remainder to Brenda and Clive in joint tenancy. All the residue of Teressas estate was left to Hillman College. While...
-
Aretta J. Parkinson owned a two-hundred-acre farm in a State that requires written authority for an agent to sell land. Prior to her death on December 23, Parkinson deeded a one-eighth undivided...
-
Identify the sources of corporate powers and explain the legal consequences of a corporations exceeding its powers.
-
Figure 4.11 shows the \(v_{x}(t)\) curves for a collision between two identical carts moving not on a low-friction track but rather on a rough surface, so that friction affects their motion. Are the...
-
(a) Classify and give examples of the kinds of processes that can change (i) the number of loaves of bread in a bakery, (ii) the number of Lego pieces inside a house, and (iii) the number of coins in...
-
Cite at least two possible choices of system in each of the following situations. For each choice, make a sketch showing the system boundary and state which objects (excluding air) are inside the...
Study smarter with the SolutionInn App