Write a ThreeWayLamp class that models the behavior of a lamp that uses a three-way bulb. These bulbs have actually four possible states: off, low light, medium light, and high light. Each tim the switch is activated, the bulb goes to the next state (from high, the next state is off, from off to low etc). The ThreeWayLamp class has a single method called switch() which takes a single int parameter indicating how many times the switch is activated. (you need to throw an exception if its negative). The switch() method should simply print out a message indicating the state of the bulb after it has changed.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here