SIMULATING AN ELEVATOR

SIMULATING AN ELEVATOR

Classes, Methods, Constructors
please i need help to create an elevator program

Simulating an Elevator
write an Elevator class containing various methods.
Then, write a program that creates Elevator objects and invokes the various methods.
put comments on methods and how methods manipulate the data of an object.

1. Using (JCreator), write a class named Elevator. Add fields for
the following attributes: an int for the current floor, an int for the floor that the elevator is heading to, a boolean to denote whether the elevator is going up or down once it reaches its destination, and a boolean to denote whether the elevator doors are open or closed.

2. Add a method named goToFloor() that changes the floor that the elevator is heading to. Use the System.out.println() method to display a message that you are changing the value.

3. Add methods named openDoors() and closeDoors() that change the appropriate boolean field accordingly. Again, display a message within each method so that you can see when the methods are invoked.

4. Add methods named goingUp() and goingDown() that change the appropriate boolean field accordingly.

5. Save and compile the Elevator class.
6. Write a class named ElevatorProgram that contains main().
7. Within main(), instantiate two Elevator objects. Invoke the various methods of the Elevator
class on these two objects, ensuring that all your Elevator methods work successfully.

then add two constructors to your Elevator class.
1. Begin by opening your Elevator class from above in your text editor(JCreator).
2. Add a constructor that has a single parameter of type int to represent the current floor of the elevator. Within the constructor, assign the parameter to the appropriate field in your class. Also, display a message using System.out.println() that shows which constructor you are currently in.
3. Add a no-argument constructor that uses the this keyword to invoke your constructor in the previous step, passing in a 1 for the initial floor. Display a message that states you are currently in the no-argument constructor.
4. Modify the ElevatorProgram in above. Instantiate one of the Elevator objects using the no- argument constructor, and instantiate the other Elevator object using the one-argument constructor.
5. Run the ElevatorProgram and ensure that the constructors are working successfully
that is how the program should be.thanks for any help rendered
View Answers









Related Tutorials/Questions & Answers:
SIMULATING AN ELEVATOR - JDBC
SIMULATING AN ELEVATOR  Classes, Methods, Constructors please i need help to create an elevator program Simulating an Elevator write an Elevator class containing various methods. Then, write a program that creates Elevator
ModuleNotFoundError: No module named 'Elevator'
ModuleNotFoundError: No module named 'Elevator'  Hi, My Python... 'Elevator' How to remove the ModuleNotFoundError: No module named 'Elevator... to install padas library. You can install Elevator python with following
Advertisements
ModuleNotFoundError: No module named 'py-elevator'
ModuleNotFoundError: No module named 'py-elevator'  Hi, My Python... 'py-elevator' How to remove the ModuleNotFoundError: No module named 'py-elevator' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'elevator-pitch-faker'
ModuleNotFoundError: No module named 'elevator-pitch-faker'  Hi...: No module named 'elevator-pitch-faker' How to remove the ModuleNotFoundError: No module named 'elevator-pitch-faker' error? Thanks   Hi
ModuleNotFoundError: No module named 'simulating-pkg-taking-2mins-to-install'
ModuleNotFoundError: No module named 'simulating-pkg-taking-2mins-to-install...: ModuleNotFoundError: No module named 'simulating-pkg-taking-2mins-to-install' How to remove the ModuleNotFoundError: No module named 'simulating-pkg
ModuleNotFoundError: No module named 'simulating-pkg-taking-10mins-to-install'
ModuleNotFoundError: No module named 'simulating-pkg-taking-10mins-to-install...: ModuleNotFoundError: No module named 'simulating-pkg-taking-10mins-to-install' How to remove the ModuleNotFoundError: No module named 'simulating-pkg
ModuleNotFoundError: No module named 'simulating-pkg-taking-1min-to-install'
ModuleNotFoundError: No module named 'simulating-pkg-taking-1min-to-install...: ModuleNotFoundError: No module named 'simulating-pkg-taking-1min-to-install' How to remove the ModuleNotFoundError: No module named 'simulating-pkg-taking-1min-to
ModuleNotFoundError: No module named 'simulating-pkg-taking-5mins-to-install'
ModuleNotFoundError: No module named 'simulating-pkg-taking-5mins-to-install...: ModuleNotFoundError: No module named 'simulating-pkg-taking-5mins-to-install' How to remove the ModuleNotFoundError: No module named 'simulating-pkg
ModuleNotFoundError: No module named 'simulating-pkg-taking-6mins-to-install'
ModuleNotFoundError: No module named 'simulating-pkg-taking-6mins-to-install...: ModuleNotFoundError: No module named 'simulating-pkg-taking-6mins-to-install' How to remove the ModuleNotFoundError: No module named 'simulating-pkg
need help creating a lift program - Java Beginners
please i need help to create an elevator program Simulating an Elevator write an Elevator class containing various methods. Then, write a program that creates Elevator objects and invokes the various methods. put comments on methods
20 Futuristic Technologies that are going to Change the World
is the next leap we can expect. 20   Space elevator ADS... to shape now. A Japanese farm announced making a 36,000 km elevator to let us... just on an elevator
I couldn't solve it
office.  A main method to test the class by simulating a minioofice with 3
assig
method to test the class by simulating a minioofice with 3 employees and 7
assig
method to test the class by simulating a minioofice with 3 employees and 7
car licensing office
by simulating a minioofice with 3 employees and 7 customers. The three employees
car licensing office
by simulating a minioofice with 3 employees and 7 customers. The three employees
car licensing office
by simulating a minioofice with 3 employees and 7 customers. The three employees
Artificial Intelligence Disciplines
the Big Data technologies. The aim of AI is to develop program for simulating
Free Java Books
is the subject area of a particular programming effort, such as "accounting," "elevator

Ads