Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3: [10 marks] Display Pyramid (filename: DisplayPyramid.java) Design an algorithm and then write a program that prompts the user to enter an integer from

image text in transcribed
image text in transcribed
Problem 3: [10 marks] Display Pyramid (filename: DisplayPyramid.java) Design an algorithm and then write a program that prompts the user to enter an integer from 1 to 15 (assume that the user always enters a valid integer) and displays a pyramid, as shown in the following sample run: Enter a number between 1 and 15: 12 o o NNNNNNNNNNN HHHHHHHHHHH NNNNNNNNNNN 8 6 7 unun ununun nurun 6 4 0 ununununununun o o 4 4 o 6 6 6 777777 8 8 8 8 8 Oo oo 12 11 10 9 9 10 9 10 11 10 11 12 7 7 9 6 6 4 Problem 4: [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: 0-------0 1 1 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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions