Categories: Order Term Paper

Python project

Out of Order Elevator (lrtevaEo)

Write a Python computer program that simulates the action of an elevator that is out of order. After simulating the motion of the elevator, your program will display a bar chart that shows the number of times the elevator stays on each floor of a twenty-five-story building.

When you arrive on the scene to begin studying the elevator, it is on the twelfth floor of the twenty-five-story building. Every five minutes the elevator either moves up one floor or down one floor. There is the same chance that the elevator will move up as move down, it is totally random. Keep track of the number of times the elevator stays at each of the twenty-five floors and display that information as a bar chart using a character like an asterisk to represent each time the elevator has visited a particular floor.

For example, our elevator starts on the twelfth floor and moves up to the thirteenth floor, five minutes later it moves up to the fourteenth floor and after another five minutes it moves back down to the thirteenth floor. A portion of a bar chart showing the number of visits the elevator made to each floor might look like this:

FloorNumber of Visits
—————————-
17
16
15
14*
13**
12*
11
10

This is only a portion of the output your program will produce. Your Bar Chart will include all 25 floors from 1 through 25. Your output will display the top floor (25) at the top and the bottom floor (1) at the bottom to properly represent the floors in the building.

Observe the elevator’s behavior for a number of hours that is entered by your user. Do not forget to validate your user’s input. Your bar chart will show how many times the elevator visited each floor.

NOTES:

  • The elevator cannot go above the twenty fifth floor or below the first floor, the ground floor.
  • Your user cannot observe for more than ten (10) hours.
  • The elevator can only go up or down one floor at a time.

This assignment allows you to use a list, generate random numbers, interact with your user, validate input, control processing with repetition structures, and format output.

In order to receive full credit for this assignment:

  • Use the correct naming convention for the file you submit.
  • Submit a program that executes correctly.
  • Include meaningful comments.

Suggested grading criteria:

  • Include a comment that contains your full name (5 points)
  • Include additional meaningful comments (10 points)
  • Use a list to correctly keep track of the number of visits (20 points)
  • Validate the user input (10 points)
  • Display a bar chart showing the number of visits to all 25 floors of the building. (25 points)
  • Provide clear and easy to follow directions. (10 points)
  • Use a repetition structure like a “for” loop. (10 points)

Example output:

FloorNumber of Visits

——————————–

25

24

23

22

21

20

19

18****

17******

16*********

15***************

14*********************

13***********************

12**********************

11****************

10*****

9

8

7

6

5

4

3

2

1