Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Out of Order Elevator (lrtevaEo) Write a C++ computer program that simulates the action of an elevator that is out of order. After simulating the

Out of Order Elevator (lrtevaEo)

Write a C++ 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 stays on 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:

Floor Number 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 25 through 1. 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 elevators behavior for a number of hours that is entered by your user. Do not forget to validate your users 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 an array, 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 an array 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:

Floor Number 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

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

What impediments deal with regulators?

Answered: 1 week ago