must be in java please do/show whole code with comments
In this laboratory \& assignment, you will draw a series of 16 dot patterns using nested for loops. You may think of the dot patterns as geometric puzzles to be solved using loop structures. Getting started When you run the program you can enter numbers for the various patterns you have to draw. In Dots. java, you will find that the shape of Pattem 1 is controlled by the following nested loop structure in the first block of the switch statement in drawPattern: As this nested loop executes, method bigDot automatically connects each dot to the jnext dot that is drawn. You may ask: "Why are most of the connections horizontal lines?" The answer lies in the order in which the loops are nested. The row loop is the outer loop and the column loop is the inner loop. This means that, for each value of the row index, an entire cycle of the column loop must be executed. Therefore, for each row, the inner column loop draws a dot in column 0 , then in column 1 , and so on through column 7 . This explains why the dots in each row are connected by a sequence of horizontal lines. When a given row is finished the last dot drawn is in column 7 . The next row begins with a dot in column 0 . Therefore, the diagonal line from upper right to lower left is drawn to depict the two successive rows. The method bigDot (row, col) arranges the details of drawing the dots and making the lines which connect successive dots. Since these details are not the main focus of this exercise, we will not discuss them here. Your Task Your task is to draw the remaining 15 dot puzzles by using appropriate loop structures. You should insert the code for the remaining 15 patterns as blocks in the switch statement of drawPattern. See the location in the file marked with the comment as shown below: // START OS YOUR CODE for the remaining patterns below... 1/ htar OS YOOR CODS for the remaining patterns below... 1/ YOUR CODE GOBS BELOK... I/ END OE YOUR CODE.. Hen your solutions are entered in the switch statement, the driver routine userLoop will enable you to interactively test all of the pattems and compare them against the solutions. Each puzzle requires giving a new twist to the loop structures. For example, in puzzles 3 to 6 , you must figure out how to replace the constants 0 and 8 in the inner loop by expressions which depend on the row index. In some of the later puzzles, you will need a sequence of loop constructs since a single nested loop structure will not be sufficient. In a few cases, you will need an extra loop variable besides row and col. However, try to use as few loops as possible, and no additional instructions besides 'for' loops