Question: 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

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
Get step-by-step solutions from verified subject matter experts
