Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I would be grateful for some helot with this Python problem. Your task is to implement the simple elevator in Python using classes. The

Hi, I would be grateful for some helot with this Python problem. Your task is to implement the simple elevator in Python using classes. The default strategy is the simple "start at the bottom, go to the top, then go to the bottom". Can you write a better strategy, one that is more efficient? Description / Specification Create three classes: Building, Elevator, and Customer. Equip the building with an elevator. Ask user to customize the number of floors and the number of customers. Program should have error checking to make sure the user inputs are valid. For example, if a user gives non-integer inputs, notify the user that the inputs are incorrect and prompt again. Each customer starts from a random floor, and has a random destination floor. Each customer will use the elevator only once, i.e., when a customer moves out of the elevator, he/she will never use it again. When all customers have reached their destination floor, the simulation is finished. Part of the grade on this assignment will be the appropriateness of your classes, methods, and any functions you use. The quality of the code will matter as well as the performance. All class methods require a docstring for a general description of the method. Implement both your own strategy and the default strategy and compare. Your strategy does not have to be better but the comparison is required. Don't use any global variables. Notes and Hints In your main function, at the beginning ask the user for the number of floors and the number of customers which can be used to create an instance of Building. Then we only need to call the run and output methods repeatedly in a while loop. Randomly select the floors (to and from) for each customer. Use the randint function from the random module. To compare efficiency of strategy, count the number of floors visited for your strategy versus the default strategy. Make a demo to create usable output from your simulation.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+j Explain the relationship between unions and MNEs.

Answered: 1 week ago