Question: Exercise 1 Create a class called Lamp Within the lamp class, have a private boolean member variable called isOn and set the default value to

 Exercise 1 Create a class called Lamp Within the lamp class,

Exercise 1 Create a class called Lamp Within the lamp class, have a private boolean member variable called isOn and set the default value to false Create 2 methods, one to get the value of the isOn boolean value and one to set the value . The method to set the isOn value should be called pullCoord and shoulo simply set the opposite of what isOn is currently set to Add two of your own member variables that will further describe a Lamp as well as two more of your own methods (be creative) Create a separate class called TestLamp which contains the main method for the program. In main, create three different lamp objects with different values for the member variables you created, test each lamp's pullCoord method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!