Question: java 2019 AP COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS off, as 4. The Light Board class models a two-dimensional display of lights, where each light is

java 2019 AP COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS off, as 4. TheLight Board class models a two-dimensional display of lights, where each lightjava

2019 AP COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS off, as 4. The Light Board class models a two-dimensional display of lights, where each light is either on represented by a Boolean value. You will implement a constructor to initialize the display and a method to evaluate a light. public class Light Board /** The lights on the board, where true represents on and false represents off. private boolean[] [] lights; /** Constructs a LightBoard object having numrows rows and numCols columns. Precondition: numrows > 0, numCols > 0 Postcondition: each light has a 40% probability of being set to on. * * public LightBoard (int numRows, int numCols) { /* to be implemented in part (a) */ } * /** Evaluates a light in row index row and column index col and returns a status as described in part (b). Precondition: row and col are valid indexes in lights. * public boolean evaluateLight (int row, int col) { /* to be implemented in part (b) */ } // There may be additional instance variables, constructors, and methods not shown. 2019 AP COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS Class information for this question public class Light Board private boolean[] [] lights public LightBoard (int numRows, int numCols) public boolean evaluateLight (int row, int col) * Complete the evaluateLight method below. /** Evaluates a light in row index row and column index col and returns a status as described in part (b). Precondition: row and col are valid indexes in lights. */ public boolean evaluateLight (int row, int col) *

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!