Question: A run is a sequence of adjacent repeated values. Write a Java class (RunsPrinter.java) with one main method that generates a sequence of 20 random


A run is a sequence of adjacent repeated values. Write a Java class (RunsPrinter.java) with one main method that generates a sequence of 20 random die tosses in an ArrayList and then prints the die values, marking the runs by including them in parentheses, like this os in an Arravlist and 12 (5 5) 3 1243 (2 22 2) 3 6 (5 5) 6 3 1 of program output. 2,33 ,6,2, 24444)6142(331 2(33)56(22) (11)(4444)6142(33)1 (55)43(11)53415152153153 1636(11)46312362565345 Hint: Use the following pseudocode: Set a boolean variable inRun to false. For each valid index i in the ArrayList f inRun If values il is different from the preceding value Print) in Run-false. If not inRurn If valueslil] is the same as the following value Print ( in Run = true. Print valuesli] If inRun, print )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
