Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied.
In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit.
Consider the following class.
public class LightSequence
{
// attributes not shown
/** The parameter seq is the initial sequence used for
* the light display
*/
public LightSequence(String seq)
{ /* implementation not shown */ }
/** Inserts the string segment in the current sequence,
* starting at the index ind. Returns the new sequence.
*/
public String insertSegment(String segment, int ind)
{ /* implementation not shown */ }
/** Updates the sequence to the value in seq
*/
public void changeSequence(String seq)
{ /* implementation not shown */ }
/** Uses the current sequence to turn the light on and off
* for the show
*/
public void display()
{ /* implementation not shown */ }
}
Write a statement to create a LightSequence object gradShow that has the initial light sequence "0101 0101 0101".
Write the statement below.