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 0. 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 0. 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).
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education