The project zip file is extracted then open with a java compiler called bluej
Project2/Aquarium$Space.class public final synchronized enum Aquarium$Space { Project2/Aquarium.class public synchronized class Aquarium { private int size; private int[] columnTotals; private int[] rowTotals; private int[][] aquariums; private Space[][] spaces; public void Aquarium(String); public void Aquarium(); public static int[] parseLine(String); public int getSize(); public int[] getColumnTotals(); public int[] getRowTotals(); public int[][] getAquariums(); public Space[][] getSpaces(); public void leftClick(int, int); public void rightClick(int, int); public void clear(); } Project2/Aquarium.ctxt #BlueJ class context comment0.target=Aquarium comment0.text=\r\n\ Aquarium\ represents\ a\ single\ problem\ in\ the\ game\ Aquarium.\r\n\r\n\ @author\ Lyndon\ While\ \r\n\ @version\ 2020\r\n comment1.params=filename comment1.target=Aquarium(java.lang.String) comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ Aquarium.\ \r\n\ Creates,\ initialises,\ and\ populates\ all\ of\ the\ fields.\r\n comment10.params=r\ c comment10.target=void\ rightClick(int,\ int) comment10.text=\r\n\ Performs\ a\ right\ click\ on\ Square\ r,c\ if\ the\ indices\ are\ legal,\ o/w\ does\ nothing.\ \r\n\ An\ air\ space\ becomes\ empty;\ other\ spaces\ become\ air.\ \r\n comment11.params= comment11.target=void\ clear() comment11.text=\r\n\ Empties\ all\ of\ the\ spaces.\r\n comment2.params= comment2.target=Aquarium() comment2.text=\r\n\ Uses\ the\ provided\ example\ file\ on\ the\ LMS\ page.\r\n comment3.params=s comment3.target=int[]\ parseLine(java.lang.String) comment3.text=\r\n\ Returns\ an\ array\ containing\ the\ ints\ in\ s,\ \r\n\ each\ of\ which\ is\ separated\ by\ one\ space.\ \r\n\ e.g.\ if\ s\ \=\ "1\ 299\ 34\ 5",\ it\ will\ return\ {1,299,34,5}\ \r\n comment4.params= comment4.target=int\ getSize() comment4.text=\r\n\ Returns\ the\ size\ of\ the\ puzzle.\r\n comment5.params= comment5.target=int[]\ getColumnTotals() comment5.text=\r\n\ Returns\ the\ column\ totals.\r\n comment6.params= comment6.target=int[]\ getRowTotals() comment6.text=\r\n\ Returns\ the\ row\ totals.\r\n comment7.params= comment7.target=int[][]\ getAquariums() comment7.text=\r\n\ Returns\ the\ board\ in\ aquariums.\r\n comment8.params= comment8.target=Space[][]\ getSpaces() comment8.text=\r\n\ Returns\ the\ board\ in\ spaces.\r\n comment9.params=r\ c comment9.target=void\ leftClick(int,\ int) comment9.text=\r\n\ Performs\ a\ left\ click\ on\ Square\ r,c\ if\ the\ indices\ are\ legal,\ o/w\ does\ nothing.\ \r\n\ A\ water\ space\ becomes\ empty;\ other\ spaces\ become\ water.\ \r\n numComments=12 Project2/Aquarium.java Project2/Aquarium.java /** * Aquarium represents a single problem in the game Aquarium. * * @author Lyndon While * @version 2020 */ public class Aquarium { private int size; // the board is size x size private int[] columnTotals; // the totals at the top of the columns, left to right private int[] rowTotals; // the totals at the left of the rows, top to bottom // the board divided into aquariums, numbered from 1,2,3,... // spaces with the same number are part of the same aquarium private int[][] aquariums; // the board divided into spaces, each empty, water, or air private Space[][] spaces; /** * Constructor for objects of class Aquarium. * Creates, initialises, and populates all of the fields. */ public Aquarium(String filename) { // TODO 3 } /** * Uses the provided example file on the LMS page. */ public Aquarium() { this("Examples/a6_1.txt"); } /** * Returns an array containing the ints in s, * each of which is separated by one space. * e.g. if s = "1 299 34 5", it will return {1,299,34,5} */ public static int[] parseLine(String s) { // TODO 2 return null; } /** * Returns the size of the puzzle. */ public int getSize() { // TODO 1a return -1; } /** * Returns the column totals. */ public int[] getColumnTotals() { // TODO 1b return null; } /** * Returns the row totals. */ public int[] getRowTotals() { // TODO 1c return null; } /** * Returns the board in aquariums. */ public int[][] getAquariums() { // TODO 1d return null; } /** * Returns the board in spaces. */ public Space[][] getSpaces() { // TODO 1e return null; } /** * Performs a left click on Square r,c if the indices are legal, o/w does nothing. * A water space becomes empty; other spaces become water. */ public void leftClick(int r, int c) { // TODO 4 } /** * Performs a right click on Square r,c if the indices are legal, o/w does nothing. * An air space becomes empty; other spaces become air. */ public void rightClick(int r, int c) { // TODO 5 } /** * Empties all of the spaces. */ public void clear() { // TODO 6 } } Project2/AquariumTest.class public synchronized class AquariumTest { private Aquarium a4; private Aquarium a6; public void AquariumTest(); public void setUp(); public void testAquarium(); public void testparseLine(); public void testleftClick(); public void testrightClick(); public void testleftandrightClick(); public void testclear(); } Project2/AquariumTest.ctxt #BlueJ class context comment0.target=AquariumTest comment0.text=\r\n\ This\ class\ provides\ unit\ test\ cases\ for\ the\ Aquarium\ class.\r\n\ @author\ Lyndon\ While\r\n\ @version\ 1.0\r\n comment1.params= comment1.target=void\ setUp() comment1.text=\r\n\ Sets\ up\ the\ test\ fixture.\r\n\r\n\ Called\ before\ every\ test\ case\ method.\r\n comment2.params= comment2.target=void\ testAquarium() comment3.params= comment3.target=void\ testparseLine() comment4.params= comment4.target=void\ testleftClick() comment5.params= comment5.target=void\ testrightClick() comment6.params= comment6.target=void\ testleftandrightClick() comment7.params= comment7.target=void\ testclear() numComments=8 Project2/AquariumTest.java Project2/AquariumTest.java import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.Arrays; /** * This class provides unit test cases for the Aquarium class. * @author Lyndon While * @version 1.0 */ public class AquariumTest { private Aquarium a4, a6; /** * Sets up the test fixture. * * Called before every test case method. */ @Before public void setUp() { a4 = new Aquarium("Examples/a4_1.txt"); a6 = new Aquarium("Examples/a6_1.txt"); } @Test public void testAquarium() { // check a4 int[][] xss = {{1,3,1,3} ,{1,4,2,1} ,{1,2,1,3} ,{1,1,1,3} ,{4,1,4,3} ,{4,4,4,5}}; assertEquals("wrong size", 4, a4.getSize()); assertTrue ("null array", a4.getColumnTotals() != null); assertEquals("wrong size", 4, a4.getColumnTotals().length); assertEquals("wrong entry", -1, Arrays.mismatch(a4.getColumnTotals(), xss[0])); assertTrue ("null array", a4.getRowTotals() != null); assertEquals("wrong size", 4, a4.getRowTotals().length); assertEquals("wrong entry", -1, Arrays.mismatch(a4.getRowTotals(), xss[1])); assertTrue ("null array", a4.getAquariums() != null); assertEquals("wrong size", 4, a4.getAquariums().length); for (int r = 0; r < 4; r++) {="" asserttrue ("null array", a4.getaquariums()[r] !=" null);" assertequals("wrong size", 4, a4.getaquariums()[r].length);="" assertequals("wrong entry", -1, arrays.mismatch(a4.getaquariums()[r], xss[r+2]));="" }="" asserttrue ("null array", a4.getspaces() !=" null);" assertequals("wrong size", 4, a4.getspaces().length);="" for (int r =""> 4; r++)>< 4; r++) {="" asserttrue ("null array", a4.getspaces()[r] !=" null);" assertequals("wrong size", 4, a4.getspaces()[r].length);="" for (int c =""> 4; r++)>< 4; c++) assertequals("wrong entry", space.empty, a4.getspaces()[r][c]);="" }="" ="" // check a6="" xss =" new int[][] {{2,3,4,5,2,1}" ,{2,4,1,3,2,5}="" ,{1,1,2,2,2,2}="" ,{1,1,1,2,6,6}="" ,{4,5,3,2,6,6}="" ,{4,5,3,3,3,6}="" ,{4,4,3,3,6,6}="" ,{4,3,3,6,6,6}};="" assertequals("wrong size", 6, a6.getsize()); ="" asserttrue ("null array", a6.getcolumntotals() !=" null);" assertequals("wrong size", 6, a6.getcolumntotals().length);="" assertequals("wrong entry", -1, arrays.mismatch(a6.getcolumntotals(), xss[0]));="" asserttrue ("null array", a6.getrowtotals() !=" null);" assertequals("wrong size", 6, a6.getrowtotals().length);="" assertequals("wrong entry", -1, arrays.mismatch(a6.getrowtotals(), xss[1]));="" asserttrue ("null array", a6.getaquariums() !=" null);" assertequals("wrong size", 6, a6.getaquariums().length);="" for (int r =""> 4; c++)>< 6; r++) {="" asserttrue ("null array", a6.getaquariums()[r] !=" null);" assertequals("wrong size", 6, a6.getaquariums()[r].length);="" assertequals("wrong entry", -1, arrays.mismatch(a6.getaquariums()[r], xss[r+2]));="" }="" asserttrue ("null array", a6.getspaces() !=" null);" assertequals("wrong size", 6, a6.getspaces().length);="" for (int r =""> 6; r++)>< 6; r++) {="" asserttrue ("null array", a6.getspaces()[r] !=" null);" assertequals("wrong size", 6, a6.getspaces()[r].length);="" for (int c =""> 6; r++)>< 6; c++) assertequals("wrong entry", space.empty, a6.getspaces()[r][c]);="" }="" }="" @test="" public void testparseline() ="" {="" int[] xs =" Aquarium.parseLine("1 23 456 7890");" asserttrue ("null array", xs !=" null);" assertequals("wrong size", 4, xs.length);="" assertequals("wrong entry", -1, arrays.mismatch(xs, new int[] {1,23,456,7890}));="" ="" xs =" Aquarium.parseLine("1 0 -1"); // needs to cope with all integers" asserttrue ("null array", xs !=" null);" assertequals("wrong size", 3, xs.length);="" assertequals("wrong entry", -1, arrays.mismatch(xs, new int[] {1,0,-1}));="" }="" @test="" public void testleftclick() ="" {="" for (int i =""> 6; c++)>< 6; i++) for (int j =""> 6; i++)>< 6; j++) {="" assertequals("wrong entry", space.empty, a6.getspaces()[i][j]);="" a6.leftclick(i,j);="" assertequals("wrong entry", space.water, a6.getspaces()[i][j]);="" a6.leftclick(i,j);="" assertequals("wrong entry", space.empty, a6.getspaces()[i][j]);="" }="" }="" @test="" public void testrightclick() ="" {="" for (int i =""> 6; j++)>< 6; i++) for (int j =""> 6; i++)>< 6; j++) {="" assertequals("wrong entry", space.empty, a6.getspaces()[i][j]);="" a6.rightclick(i,j);="" assertequals("wrong entry", space.air, a6.getspaces()[i][j]);="" a6.rightclick(i,j);="" assertequals("wrong entry", space.empty, a6.getspaces()[i][j]);="" }="" }="" @test="" public void testleftandrightclick() ="" {="" for (int i =""> 6; j++)>< 6; i++) for (int j =""> 6; i++)>< 6; j++) {="" assertequals("wrong entry", space.empty, a6.getspaces()[i][j]);="" a6.rightclick(i,j);="" assertequals("wrong entry", space.air, a6.getspaces()[i][j]);="" a6.leftclick(i,j);="" assertequals("wrong entry", space.water, a6.getspaces()[i][j]);="" a6.rightclick(i,j);="" assertequals("wrong entry", space.air, a6.getspaces()[i][j]);="" }="" }="" @test="" public void testclear() ="" {="" testaquarium();="" for (int i =""> 6; j++)>< 6; i++) for (int j =""> 6; i++)>< 6; j++) // mix up the clicks for fun if ((i + j) % 2 == 0) { a6.leftclick(i,j); a4.rightclick(i,j); } else { a6.rightclick(i,j); a4.leftclick(i,j); } a6.clear(); a4.clear(); testaquarium(); } } project2/aquariumviewer.class public synchronized class aquariumviewer implements java.awt.event.mouselistener { private final int boxsize; private final int offset; private int windowsize; private aquarium puzzle; private int size; private simplecanvas sc; public void aquariumviewer(aquarium); public void aquariumviewer(int); public void aquariumviewer(); public aquarium getpuzzle(); public int getsize(); public simplecanvas getcanvas(); private void displaypuzzle(); public void displaygrid(); public void displaynumbers(); public void displayaquariums(); public void displaybuttons(); public void updatesquare(int, int); public void mousepressed(java.awt.event.mouseevent); public void mouseclicked(java.awt.event.mouseevent); public void mousereleased(java.awt.event.mouseevent); public void mouseentered(java.awt.event.mouseevent); public void mouseexited(java.awt.event.mouseevent); } project2/aquariumviewer.ctxt #bluej class context comment0.target=aquariumviewer comment1.params=puzzle comment1.target=aquariumviewer(aquarium) comment1.text=\r\n\ main\ constructor\ for\ objects\ of\ class\ aquariumviewer.\r\n\ sets\ all\ fields,\ and\ displays\ the\ initial\ puzzle.\r\n comment10.params= comment10.target=void\ displayaquariums() comment10.text=\r\n\ displays\ the\ aquariums.\r\n comment11.params= comment11.target=void\ displaybuttons() comment11.text=\r\n\ displays\ the\ buttons\ below\ the\ grid.\r\n comment12.params=r\ c comment12.target=void\ updatesquare(int,\ int) comment12.text=\r\n\ updates\ the\ display\ of\ square\ r,c.\ \r\n\ sets\ the\ display\ of\ this\ square\ to\ whatever\ is\ in\ the\ squares\ array.\ \r\n comment13.params=e comment13.target=void\ mousepressed(java.awt.event.mouseevent) comment13.text=\r\n\ responds\ to\ a\ mouse\ click.\ \r\n\ if\ it's\ on\ the\ board,\ make\ the\ appropriate\ move\ and\ update\ the\ screen\ display.\ \r\n\ if\ it's\ on\ solved?,\ \ \ check\ the\ solution\ and\ display\ the\ result.\ \r\n\ if\ it's\ on\ clear,\ \ \ \ \ clear\ the\ puzzle\ and\ update\ the\ screen\ display.\ \r\n comment14.params=e comment14.target=void\ mouseclicked(java.awt.event.mouseevent) comment15.params=e comment15.target=void\ mousereleased(java.awt.event.mouseevent) comment16.params=e comment16.target=void\ mouseentered(java.awt.event.mouseevent) comment17.params=e comment17.target=void\ mouseexited(java.awt.event.mouseevent) comment2.params=n comment2.target=aquariumviewer(int) comment2.text=\r\n\ selects\ from\ among\ the\ provided\ files\ in\ folder\ examples.\ \r\n\ xyz\ selects\ axy_z.txt.\ \r\n comment3.params= comment3.target=aquariumviewer() comment3.text=\r\n\ uses\ the\ provided\ example\ file\ on\ the\ lms\ page.\r\n comment4.params= comment4.target=aquarium\ getpuzzle() comment4.text=\r\n\ returns\ the\ current\ state\ of\ the\ puzzle.\r\n comment5.params= comment5.target=int\ getsize() comment5.text=\r\n\ returns\ the\ size\ of\ the\ puzzle.\r\n comment6.params= comment6.target=simplecanvas\ getcanvas() comment6.text=\r\n\ returns\ the\ current\ state\ of\ the\ canvas.\r\n comment7.params= comment7.target=void\ displaypuzzle() comment7.text=\r\n\ displays\ the\ initial\ puzzle;\ see\ the\ lms\ page\ for\ the\ format.\r\n comment8.params= comment8.target=void\ displaygrid() comment8.text=\r\n\ displays\ the\ grid\ in\ the\ middle\ of\ the\ window.\r\n comment9.params= comment9.target=void\ displaynumbers() comment9.text=\r\n\ displays\ the\ numbers\ around\ the\ grid.\r\n numcomments=18 project2/aquariumviewer.java project2/aquariumviewer.java /** * aquariumviewer represents an interface for playing a game of aquarium. * * @author lyndon while * @version 2020 */ import java.awt.*; import java.awt.event.*; import javax.swing.swingutilities; public class aquariumviewer implements mouselistener { private final int boxsize = 40; // the size of each square private final int offset = boxsize * 2; // the gap around the board private int windowsize; // set this in the constructor private aquarium puzzle; // the internal representation of the puzzle private int size; // the puzzle is size x size private simplecanvas sc; // the display window /** * main constructor for objects of class aquariumviewer. * sets all fields, and displays the initial puzzle. */ public aquariumviewer(aquarium puzzle) { // todo 8 } /** * selects from among the provided files in folder examples. * xyz selects axy_z.txt. */ public aquariumviewer(int n) { this(new aquarium("examples/a" + n / 10 + "_" + n % 10 + ".txt")); } /** * uses the provided example file on the lms page. */ public aquariumviewer() { this(61); } /** * returns the current state of the puzzle. */ public aquarium getpuzzle() { // todo 7a return null; } /** * returns the size of the puzzle. */ public int getsize() { // todo 7b return -1; } /** * returns the current state of the canvas. */ public simplecanvas getcanvas() { // todo 7c return null; } /** * displays the initial puzzle; see the lms page for the format. */ private void displaypuzzle() { // todo 13 } /** * displays the grid in the middle of the window. */ public void displaygrid() { // todo 9 } /** * displays the numbers around the grid. */ public void displaynumbers() { // todo 10 } /** * displays the aquariums. */ public void displayaquariums() { // todo 11 } /** * displays the buttons below the grid. */ public void displaybuttons() { // todo 12 } /** * updates the display of square r,c. * sets the display of this square to whatever is in the squares array. */ public void updatesquare(int r, int c) { // todo 14 } /** * responds to a mouse click. * if it's on the board, make the appropriate move and update the screen display. * if it's on solved?, check the solution and display the result. * if it's on clear, clear the puzzle and update the screen display. */ public void mousepressed(mouseevent e) { // todo 15 } public void mouseclicked(mouseevent e) {} public void mousereleased(mouseevent e) {} public void mouseentered(mouseevent e) {} public void mouseexited(mouseevent e) {} } project2/aquariumviewertest.class public synchronized class aquariumviewertest { private aquariumviewer b4; private aquariumviewer b6; public void aquariumviewertest(); public void setup(); public void testboardviewer(); public void testdisplaymethods(); } project2/aquariumviewertest.ctxt #bluej class context comment0.target=aquariumviewertest comment0.text=\r\n\ this\ class\ provides\ unit\ test\ cases\ for\ the\ aquariumviewer\ class.\r\n\ @author\ lyndon\ while\r\n\ @version\ 1.0\r\n comment1.params= comment1.target=void\ setup() comment1.text=\r\n\ sets\ up\ the\ test\ fixture.\r\n\r\n\ called\ before\ every\ test\ case\ method.\r\n comment2.params= comment2.target=void\ testboardviewer() comment3.params= comment3.target=void\ testdisplaymethods() numcomments=4 project2/aquariumviewertest.java project2/aquariumviewertest.java import static org.junit.assert.*; import org.junit.after; import org.junit.before; // mix up the clicks for fun="" if ((i + j) % 2 ="= 0) " {="" a6.leftclick(i,j);="" a4.rightclick(i,j);="" }="" else="" {="" a6.rightclick(i,j);="" a4.leftclick(i,j);="" }="" a6.clear();="" a4.clear();="" testaquarium();="" }="" }="" project2/aquariumviewer.class="" public="" synchronized="" class="" aquariumviewer="" implements="" java.awt.event.mouselistener="" {="" private="" final="" int="" boxsize;="" private="" final="" int="" offset;="" private="" int="" windowsize;="" private="" aquarium="" puzzle;="" private="" int="" size;="" private="" simplecanvas="" sc;="" public="" void="" aquariumviewer(aquarium);="" public="" void="" aquariumviewer(int);="" public="" void="" aquariumviewer();="" public="" aquarium="" getpuzzle();="" public="" int="" getsize();="" public="" simplecanvas="" getcanvas();="" private="" void="" displaypuzzle();="" public="" void="" displaygrid();="" public="" void="" displaynumbers();="" public="" void="" displayaquariums();="" public="" void="" displaybuttons();="" public="" void="" updatesquare(int,="" int);="" public="" void="" mousepressed(java.awt.event.mouseevent);="" public="" void="" mouseclicked(java.awt.event.mouseevent);="" public="" void="" mousereleased(java.awt.event.mouseevent);="" public="" void="" mouseentered(java.awt.event.mouseevent);="" public="" void="" mouseexited(java.awt.event.mouseevent);="" }="" project2/aquariumviewer.ctxt="" #bluej="" class="" context="" comment0.target="AquariumViewer" comment1.params="puzzle" comment1.target="AquariumViewer(Aquarium)" comment1.text="\r\n\" main\="" constructor\="" for\="" objects\="" of\="" class\="" aquariumviewer.\r\n\="" sets\="" all\="" fields,\="" and\="" displays\="" the\="" initial\="" puzzle.\r\n="" comment10.params="comment10.target=void\" displayaquariums()="" comment10.text="\r\n\" displays\="" the\="" aquariums.\r\n="" comment11.params="comment11.target=void\" displaybuttons()="" comment11.text="\r\n\" displays\="" the\="" buttons\="" below\="" the\="" grid.\r\n="" comment12.params="r\" c="" comment12.target="void\" updatesquare(int,\="" int)="" comment12.text="\r\n\" updates\="" the\="" display\="" of\="" square\="" r,c.\="" \r\n\="" sets\="" the\="" display\="" of\="" this\="" square\="" to\="" whatever\="" is\="" in\="" the\="" squares\="" array.\="" \r\n="" comment13.params="e" comment13.target="void\" mousepressed(java.awt.event.mouseevent)="" comment13.text="\r\n\" responds\="" to\="" a\="" mouse\="" click.\="" \r\n\="" if\="" it's\="" on\="" the\="" board,\="" make\="" the\="" appropriate\="" move\="" and\="" update\="" the\="" screen\="" display.\="" \r\n\="" if\="" it's\="" on\="" solved?,\="" \="" \="" check\="" the\="" solution\="" and\="" display\="" the\="" result.\="" \r\n\="" if\="" it's\="" on\="" clear,\="" \="" \="" \="" \="" clear\="" the\="" puzzle\="" and\="" update\="" the\="" screen\="" display.\="" \r\n="" comment14.params="e" comment14.target="void\" mouseclicked(java.awt.event.mouseevent)="" comment15.params="e" comment15.target="void\" mousereleased(java.awt.event.mouseevent)="" comment16.params="e" comment16.target="void\" mouseentered(java.awt.event.mouseevent)="" comment17.params="e" comment17.target="void\" mouseexited(java.awt.event.mouseevent)="" comment2.params="n" comment2.target="AquariumViewer(int)" comment2.text="\r\n\" selects\="" from\="" among\="" the\="" provided\="" files\="" in\="" folder\="" examples.\="" \r\n\="" xyz\="" selects\="" axy_z.txt.\="" \r\n="" comment3.params="comment3.target=AquariumViewer()" comment3.text="\r\n\" uses\="" the\="" provided\="" example\="" file\="" on\="" the\="" lms\="" page.\r\n="" comment4.params="comment4.target=Aquarium\" getpuzzle()="" comment4.text="\r\n\" returns\="" the\="" current\="" state\="" of\="" the\="" puzzle.\r\n="" comment5.params="comment5.target=int\" getsize()="" comment5.text="\r\n\" returns\="" the\="" size\="" of\="" the\="" puzzle.\r\n="" comment6.params="comment6.target=SimpleCanvas\" getcanvas()="" comment6.text="\r\n\" returns\="" the\="" current\="" state\="" of\="" the\="" canvas.\r\n="" comment7.params="comment7.target=void\" displaypuzzle()="" comment7.text="\r\n\" displays\="" the\="" initial\="" puzzle;\="" see\="" the\="" lms\="" page\="" for\="" the\="" format.\r\n="" comment8.params="comment8.target=void\" displaygrid()="" comment8.text="\r\n\" displays\="" the\="" grid\="" in\="" the\="" middle\="" of\="" the\="" window.\r\n="" comment9.params="comment9.target=void\" displaynumbers()="" comment9.text="\r\n\" displays\="" the\="" numbers\="" around\="" the\="" grid.\r\n="" numcomments="18" project2/aquariumviewer.java="" project2/aquariumviewer.java="" **="" * aquariumviewer represents an interface for playing a game of aquarium.="" *="" * @author lyndon while="" * @version 2020="" */="" import java.awt.*;="" import java.awt.event.*; ="" import javax.swing.swingutilities;="" public class aquariumviewer implements mouselistener="" {="" private final int boxsize =" 40; // the size of each square" private final int offset =" BOXSIZE * 2; // the gap around the board" private int windowsize; // set this in the constructor ="" ="" private aquarium puzzle; // the internal representation of the puzzle="" private int size; // the puzzle is size x size="" private simplecanvas sc; // the display window="" /**="" * main constructor for objects of class aquariumviewer.="" * sets all fields, and displays the initial puzzle.="" */="" public aquariumviewer(aquarium puzzle)="" {="" // todo 8="" }="" ="" /**="" * selects from among the provided files in folder examples. ="" * xyz selects axy_z.txt. ="" */="" public aquariumviewer(int n)="" {="" this(new aquarium("examples/a" + n / 10 + "_" + n % 10 + ".txt"));="" }="" ="" /**="" * uses the provided example file on the lms page.="" */="" public aquariumviewer()="" {="" this(61);="" }="" ="" /**="" * returns the current state of the puzzle.="" */="" public aquarium getpuzzle()="" {="" // todo 7a="" return null;="" }="" ="" /**="" * returns the size of the puzzle.="" */="" public int getsize()="" {="" // todo 7b="" return -1;="" }="" /**="" * returns the current state of the canvas.="" */="" public simplecanvas getcanvas()="" {="" // todo 7c="" return null;="" }="" ="" /**="" * displays the initial puzzle; see the lms page for the format.="" */="" private void displaypuzzle()="" {="" // todo 13="" }="" ="" /**="" * displays the grid in the middle of the window.="" */="" public void displaygrid()="" {="" // todo 9="" }="" ="" /**="" * displays the numbers around the grid.="" */="" public void displaynumbers()="" {="" // todo 10="" }="" ="" /**="" * displays the aquariums.="" */="" public void displayaquariums()="" {="" // todo 11="" }="" ="" /**="" * displays the buttons below the grid.="" */="" public void displaybuttons()="" {="" // todo 12="" }="" ="" /**="" * updates the display of square r,c. ="" * sets the display of this square to whatever is in the squares array. ="" */="" public void updatesquare(int r, int c)="" {="" // todo 14="" }="" ="" /**="" * responds to a mouse click. ="" * if it's on the board, make the appropriate move and update the screen display. ="" * if it's on solved?, check the solution and display the result. ="" * if it's on clear, clear the puzzle and update the screen display. ="" */="" public void mousepressed(mouseevent e) ="" {="" // todo 15="" }="" public void mouseclicked(mouseevent e) {}="" public void mousereleased(mouseevent e) {}="" public void mouseentered(mouseevent e) {}="" public void mouseexited(mouseevent e) {}="" }="" project2/aquariumviewertest.class="" public="" synchronized="" class="" aquariumviewertest="" {="" private="" aquariumviewer="" b4;="" private="" aquariumviewer="" b6;="" public="" void="" aquariumviewertest();="" public="" void="" setup();="" public="" void="" testboardviewer();="" public="" void="" testdisplaymethods();="" }="" project2/aquariumviewertest.ctxt="" #bluej="" class="" context="" comment0.target="AquariumViewerTest" comment0.text="\r\n\" this\="" class\="" provides\="" unit\="" test\="" cases\="" for\="" the\="" aquariumviewer\="" class.\r\n\="" @author\="" lyndon\="" while\r\n\="" @version\="" 1.0\r\n="" comment1.params="comment1.target=void\" setup()="" comment1.text="\r\n\" sets\="" up\="" the\="" test\="" fixture.\r\n\r\n\="" called\="" before\="" every\="" test\="" case\="" method.\r\n="" comment2.params="comment2.target=void\" testboardviewer()="" comment3.params="comment3.target=void\" testdisplaymethods()="" numcomments="4" project2/aquariumviewertest.java="" project2/aquariumviewertest.java="" import static org.junit.assert.*;="" import org.junit.after;=""> 6; j++) // mix up the clicks for fun if ((i + j) % 2 == 0) { a6.leftclick(i,j); a4.rightclick(i,j); } else { a6.rightclick(i,j); a4.leftclick(i,j); } a6.clear(); a4.clear(); testaquarium(); } } project2/aquariumviewer.class public synchronized class aquariumviewer implements java.awt.event.mouselistener { private final int boxsize; private final int offset; private int windowsize; private aquarium puzzle; private int size; private simplecanvas sc; public void aquariumviewer(aquarium); public void aquariumviewer(int); public void aquariumviewer(); public aquarium getpuzzle(); public int getsize(); public simplecanvas getcanvas(); private void displaypuzzle(); public void displaygrid(); public void displaynumbers(); public void displayaquariums(); public void displaybuttons(); public void updatesquare(int, int); public void mousepressed(java.awt.event.mouseevent); public void mouseclicked(java.awt.event.mouseevent); public void mousereleased(java.awt.event.mouseevent); public void mouseentered(java.awt.event.mouseevent); public void mouseexited(java.awt.event.mouseevent); } project2/aquariumviewer.ctxt #bluej class context comment0.target=aquariumviewer comment1.params=puzzle comment1.target=aquariumviewer(aquarium) comment1.text=\r\n\ main\ constructor\ for\ objects\ of\ class\ aquariumviewer.\r\n\ sets\ all\ fields,\ and\ displays\ the\ initial\ puzzle.\r\n comment10.params= comment10.target=void\ displayaquariums() comment10.text=\r\n\ displays\ the\ aquariums.\r\n comment11.params= comment11.target=void\ displaybuttons() comment11.text=\r\n\ displays\ the\ buttons\ below\ the\ grid.\r\n comment12.params=r\ c comment12.target=void\ updatesquare(int,\ int) comment12.text=\r\n\ updates\ the\ display\ of\ square\ r,c.\ \r\n\ sets\ the\ display\ of\ this\ square\ to\ whatever\ is\ in\ the\ squares\ array.\ \r\n comment13.params=e comment13.target=void\ mousepressed(java.awt.event.mouseevent) comment13.text=\r\n\ responds\ to\ a\ mouse\ click.\ \r\n\ if\ it's\ on\ the\ board,\ make\ the\ appropriate\ move\ and\ update\ the\ screen\ display.\ \r\n\ if\ it's\ on\ solved?,\ \ \ check\ the\ solution\ and\ display\ the\ result.\ \r\n\ if\ it's\ on\ clear,\ \ \ \ \ clear\ the\ puzzle\ and\ update\ the\ screen\ display.\ \r\n comment14.params=e comment14.target=void\ mouseclicked(java.awt.event.mouseevent) comment15.params=e comment15.target=void\ mousereleased(java.awt.event.mouseevent) comment16.params=e comment16.target=void\ mouseentered(java.awt.event.mouseevent) comment17.params=e comment17.target=void\ mouseexited(java.awt.event.mouseevent) comment2.params=n comment2.target=aquariumviewer(int) comment2.text=\r\n\ selects\ from\ among\ the\ provided\ files\ in\ folder\ examples.\ \r\n\ xyz\ selects\ axy_z.txt.\ \r\n comment3.params= comment3.target=aquariumviewer() comment3.text=\r\n\ uses\ the\ provided\ example\ file\ on\ the\ lms\ page.\r\n comment4.params= comment4.target=aquarium\ getpuzzle() comment4.text=\r\n\ returns\ the\ current\ state\ of\ the\ puzzle.\r\n comment5.params= comment5.target=int\ getsize() comment5.text=\r\n\ returns\ the\ size\ of\ the\ puzzle.\r\n comment6.params= comment6.target=simplecanvas\ getcanvas() comment6.text=\r\n\ returns\ the\ current\ state\ of\ the\ canvas.\r\n comment7.params= comment7.target=void\ displaypuzzle() comment7.text=\r\n\ displays\ the\ initial\ puzzle;\ see\ the\ lms\ page\ for\ the\ format.\r\n comment8.params= comment8.target=void\ displaygrid() comment8.text=\r\n\ displays\ the\ grid\ in\ the\ middle\ of\ the\ window.\r\n comment9.params= comment9.target=void\ displaynumbers() comment9.text=\r\n\ displays\ the\ numbers\ around\ the\ grid.\r\n numcomments=18 project2/aquariumviewer.java project2/aquariumviewer.java /** * aquariumviewer represents an interface for playing a game of aquarium. * * @author lyndon while * @version 2020 */ import java.awt.*; import java.awt.event.*; import javax.swing.swingutilities; public class aquariumviewer implements mouselistener { private final int boxsize = 40; // the size of each square private final int offset = boxsize * 2; // the gap around the board private int windowsize; // set this in the constructor private aquarium puzzle; // the internal representation of the puzzle private int size; // the puzzle is size x size private simplecanvas sc; // the display window /** * main constructor for objects of class aquariumviewer. * sets all fields, and displays the initial puzzle. */ public aquariumviewer(aquarium puzzle) { // todo 8 } /** * selects from among the provided files in folder examples. * xyz selects axy_z.txt. */ public aquariumviewer(int n) { this(new aquarium("examples/a" + n / 10 + "_" + n % 10 + ".txt")); } /** * uses the provided example file on the lms page. */ public aquariumviewer() { this(61); } /** * returns the current state of the puzzle. */ public aquarium getpuzzle() { // todo 7a return null; } /** * returns the size of the puzzle. */ public int getsize() { // todo 7b return -1; } /** * returns the current state of the canvas. */ public simplecanvas getcanvas() { // todo 7c return null; } /** * displays the initial puzzle; see the lms page for the format. */ private void displaypuzzle() { // todo 13 } /** * displays the grid in the middle of the window. */ public void displaygrid() { // todo 9 } /** * displays the numbers around the grid. */ public void displaynumbers() { // todo 10 } /** * displays the aquariums. */ public void displayaquariums() { // todo 11 } /** * displays the buttons below the grid. */ public void displaybuttons() { // todo 12 } /** * updates the display of square r,c. * sets the display of this square to whatever is in the squares array. */ public void updatesquare(int r, int c) { // todo 14 } /** * responds to a mouse click. * if it's on the board, make the appropriate move and update the screen display. * if it's on solved?, check the solution and display the result. * if it's on clear, clear the puzzle and update the screen display. */ public void mousepressed(mouseevent e) { // todo 15 } public void mouseclicked(mouseevent e) {} public void mousereleased(mouseevent e) {} public void mouseentered(mouseevent e) {} public void mouseexited(mouseevent e) {} } project2/aquariumviewertest.class public synchronized class aquariumviewertest { private aquariumviewer b4; private aquariumviewer b6; public void aquariumviewertest(); public void setup(); public void testboardviewer(); public void testdisplaymethods(); } project2/aquariumviewertest.ctxt #bluej class context comment0.target=aquariumviewertest comment0.text=\r\n\ this\ class\ provides\ unit\ test\ cases\ for\ the\ aquariumviewer\ class.\r\n\ @author\ lyndon\ while\r\n\ @version\ 1.0\r\n comment1.params= comment1.target=void\ setup() comment1.text=\r\n\ sets\ up\ the\ test\ fixture.\r\n\r\n\ called\ before\ every\ test\ case\ method.\r\n comment2.params= comment2.target=void\ testboardviewer() comment3.params= comment3.target=void\ testdisplaymethods() numcomments=4 project2/aquariumviewertest.java project2/aquariumviewertest.java import static org.junit.assert.*; import org.junit.after; import org.junit.before;>