Java 3 Create Class Representing Elevator Private Fields Number Floors Current Position El Q37063670

Java 3) Create a class representing an elevator. The privatefields are: number of floors, current position of the elevator,boolean value stating whether the elevator is moving, the requestedfloor. Create a proper constructor, accessors and mutators, thetoString method.


Answer


public class Elevator { private int numFloors; private int currentFloor; private boolean isMoving; private int requestedFloor; public Elevator() { } public Elevator(int numFloors, int currentFloor, boolean isMoving, int requestedFloor) { this.numFloors = numFloors;

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.