Status: Not Started
  • LightBoard.java
  • LightBoardTester.java
Font Size
14
Parentheses autocomplete
Wrap lines
Editor
Theme
Code with blocks by default
Console Font Size
12
Console Theme
Display Server Graphics Screen
Show File Tab Bar
Debug Mode
6 LightBoard Part B (Run Code)
LightBoardTester.java
public class LightBoardTester
{
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output
Docs
Exercise
More
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This student is viewing this assignment in English. View this page in English?

5 points

Write the method evaluateLight, which computes and returns the status of a light at a given row and column based on the following rules.

  1. If the light is on, return false if the number of lights in its column that are on is even, including the current light.
  2. If the light is off, return true if the number of lights in its column that are on is divisible by three.
  3. Otherwise, return the light’s current status.

For example, suppose that LightBoard sim = new LightBoard(7, 5) creates a light board with the initial state shown below, where true represents a light that is on and false represents a light that is off. Lights that are off are shaded.

Note:
This assignment does not have an autograder! Use the LightBoardTester method to compare the results of evaluateLight to the lightboard that is created from the constructor.

Reset Code

Slides and Notes

No slides available for this video

About

Java (main)
Java Version 1.8.0_222