Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using only loop and not using any method in java Problem 1: [20 marks] Simulate the movement of an elevator (filename: Elevator.java) Design an algorithm

using only loop and not using any method in java image text in transcribed
image text in transcribed
Problem 1: [20 marks] Simulate the movement of an elevator (filename: Elevator.java) Design an algorithm and then write a program called Elevator, which models a simplified elevator a) The elevator operates in a building with 9 floors. The labelling of the floors begins at 1. b) The user will request a floor by typing in an integer in the appropriate range. The elevator you are modelling needs to move to the requested floor, displaying floor numbers and a picture of an up/down arrow as it goes. c) The program should continue moving to new floors and prompting for a floor selection until the user enters a sentinel value of O instead of a floor number. When the sentinel value is entered, the program should exit. d) If the entered floor number is not valid, the user should be warned, and the user is asked to enter a floor number again. A sample runs is given below: 1 ---- 0.0 The elevator is at Floor 1 now Enter a floor number between 1 and 9 or enter 0 to quit: 5 The elevator is moving up from Floor 1 to 5 15 IA 0 - A 41 AM A 31 A DOW OO A 2 --- A 1 AN OO The elevator is at Floor 5 now Enter a floor number between 1 and 9, or enter 0 to quit: 12 Invalid floor number. Try again. Enter a floor number between 1 and 9 or enter to quit 3 The elevator is moving down from Floor 5 to 3 FIFIEI 31 The elevator is at Floor 3 Bow Enter a floor number between 1 and 9 or enter to quito Thank you for using the elevator program. Goodbye

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago