Question: Write a Circuit Tester class that tests all switch combinations in Exercise E3.4, printing out actual and expected states for the switches and lamps.

Write a Circuit Tester class that tests all switch combinations in Exercise •• E3.4, printing out actual and expected states for the switches and lamps.

Data from Exercise E3.4

Simulate a circuit for controlling a hallway light that has switches at both ends of
the hallway. Each switch can be up or down, and the light can be on or off. Toggling
either switch turns the lamp on or off.

Provide methods public int getFirstSwitchState() // 0 for down, 1 for up

Provide methods public int getFirstSwitchState() // 0 for down, 1 for up public int getSecondSwitchState() public int get LampState() // O for off, 1 for on public void toggleFirstSwitch() public void toggleSecondSwitch()

Step by Step Solution

3.52 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To create a CircuitTester class that tests all switch combinations as described in the provided exercise we first need to create a class to simulate t... View full answer

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 Java Programming Questions!