88 Introduction to Java Applications Chapter 2 resent (Web host server)

88 Introduction to Java Applications Chapter 2 resent the elevator door because mesh allows us to see inside the elevator). The floor door opens concurrently with the elevator door, so it appears as if both doors open at the same time. A person sees only one door, depending on that person s location. When the person is inside the elevator, the person sees the elevator door and can exit the elevator when this door opens; when the person is outside the elevator, the person sees the floor door and can enter the elevator when that door opens1. The elevator starts on the first floor with all the doors closed. To conserve energy, the elevator moves only when necessary. For simplicity, the elevator and floors each have a capacity of only one person.2 The user of our application should, at any time, be able to create a unique person in the simulation and situate that person on either the first or second floor (Fig. 2.22). When created, the person walks across the floor to the elevator. The person then presses a button on the floor next to the elevator shaft (referred to as a floor button ). When pressed, that floor button illuminates, then requests the elevator. When summoned, the elevator travels to the person s floor. If the elevator is already on that person floor, the elevator does not travel. Upon arrival, the elevator resets the button inside the elevator (called the elevator button ), sounds the bell inside the elevator, then opens the elevator door (which opens the floor door on that floor). The elevator then signals the elevator shaft of the arrival. The elevator shaft, upon receiving this message, resets the floor button and illuminates the light on that floor. Occasionally, a person requests the elevator when it is moving. If the request was generated at the floor from which the elevator just departed, the elevator must remember to revisit that floor after carrying the current passenger to the other floor. When the floor door opens, the person enters the elevator after the elevator passenger (if there is one) exits. If a person neither enters nor requests the elevator, the elevator closes its door and remains on that floor until the next person presses a floor button to summon the elevator. When a person enters the elevator, that person presses the elevator button, which also illuminates when pressed. The elevator closes its door (which also closes the floor door on that floor) and moves to the opposite floor. The elevator takes five seconds to travel between floors. When the elevator arrives at the destination floor, the elevator door opens (along with the floor door on that floor) and the person exits the elevator. The application user introduces a person onto the first or second floor by pressing the First Floor button or the Second Floor button, respectively. When the user presses the First Floor button, a person should be created (by the elevator simulation) and positioned on the first floor of the building. When the user presses the Second Floor button, a person should be created and positioned on the second floor. Over time, the user can create any number of people in the simulation, but the user cannot create a new person on an occupied floor. For example, Fig. 2.22 shows that the First Floor button is disabled to prevent the user from creating more than one person on the first floor. Figure 2.23 shows that this button is reenabled when the person rides the elevator. 1. Most people do not consider this when riding an elevator they really think of one elevator door, when in reality, there is a door in the elevator and a door on the floor, and these doors open and close in tandem. 2. After you have studied this case study, you may want to modify it to allow more than one person to ride the elevator at once and more than one person to wait on each floor at once. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

Leave a Reply