Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will make an applet that will draw a building using loops. a. The height of the building will be 10 stories b. You will
You will make an applet that will draw a building using loops. a. The height of the building will be 10 stories b. You will write a method that will draw a single story of the building. c. You will use a loop to draw each story of the building. E.g. there will be 10 stories to the building, so your loop will iterate 10 times each iteration drawing a single story. d. Each story will have a given number of windows, e. You will write a method that will draw the windows in each story. You will use a loop to draw each of the windows in each story. f. You need 10 stories. For each story, you will draw all windows. 2. The elevator should move from the current floor to the new floor when the button is pressed a. You will have a JComboBox that will be used to choose which floor the elevator will move to. b. When the floor is chosen from the JComboBox, the user should press a button to move the elevator to that floor. c. When the button is pressed, the elevator should appear at the new floor. d. If you want a real challenge, you can make an animation that will show the elevator moving from floor to floor for each floor between the current floor and the new floor. import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ItemListener; public abstract class Elevator extends JApplet implements ActionListener, ItemListener { int appletWidth, appletHeight; int buildingWidth, storyHeight, windowGap = 5, elevatorX, elevatorY; final int NUM_FLOORS = 10; JButton start; JComboBox floorChoice; BorderLayout border; BoxLayout controlBox; JPanel control; int currentFloor, newFloor; Graphics2D g2d; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started