In C++ Language using Functions and Pointers PROBLEM: Consider the elevator in the Faculty of Engineering (5 storey). Write a program which accepts the floor number where a passenger (student/faculty/other personnel) will ride the elevator. The passenger can then input the target destination floor. SPECIFICATIONS: Implement the class diagram below: Inside the main method, create an instance of the class Elevator. Use the goUp or goDown methods to generate the program display. Passenger can ride in any floor (1,2,3,4 or 5). Program will prompt the user with the target destination floor. After the user input: Program will display the floors which the elevator passes through, and finally the destination floor. Elevator will not move if the input for destination floor is the same as the present floor. Program will notify the user and then terminate. Program will also terminate if the input destination is not 1,2,3,4 or 5. You’re free to format the input/output display. Observe proper code indention All lines should have a comment TEST CASE #1: If the starting floor is 1 and destination floor is 5, Program will display: “2” “3” “4” “now in level 5” TEST CASE #2: If the starting floor is 2 and destination floor is 2, Program will display: “start and destination floor is the same”

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter14: Introduction To Swing Components
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question

In C++ Language using Functions and Pointers

PROBLEM: Consider the elevator in the Faculty of Engineering (5 storey). Write a program which accepts the floor number where a passenger (student/faculty/other personnel) will ride the elevator. The passenger can then input the target destination floor.

SPECIFICATIONS:

Implement the class diagram below:

  • Inside the main method, create an instance of the class Elevator. Use the goUp or goDown methods to generate the program display.
    Passenger can ride in any floor (1,2,3,4 or 5).

  • Program will prompt the user with the target destination floor. After the user input:
    • Program will display the floors which the elevator passes through, and finally the destination floor.
    • Elevator will not move if the input for destination floor is the same as the present floor. Program will notify the user and then terminate.
    • Program will also terminate if the input destination is not 1,2,3,4 or 5.

  • You’re free to format the input/output display.

  • Observe proper code indention

  • All lines should have a comment

TEST CASE #1:

If the starting floor is 1 and destination floor is 5,

Program will display:

“2”

“3”

“4”

“now in level 5”


TEST CASE #2:

If the starting floor is 2 and destination floor is 2,

Program will display:

“start and destination floor is the same”

Elevator
- noLevels: int
+ Elevator(int _levels)
+goUp(int from, int to): void
goDown(int from, int to): void
Transcribed Image Text:Elevator - noLevels: int + Elevator(int _levels) +goUp(int from, int to): void goDown(int from, int to): void
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Generic Type
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage