Question: This assignment does not require any coding. You can draw Use Case models by hand, or by using any software tool of your choosing. Part
This assignment does not require any coding. You can draw Use Case models by hand, or by using any software tool of your choosing. Part 1: Design a UML Use Case model to specify the code you developed in the previous assignment. Part 2: Design a UML Use Case model for a complete Battle Ship game. You can use a specific Battle Ship game or use a hypothetical one as a reference. Your Use Case model should contain at least 10 Use Cases and demonstrate all Use Case Model elements, such as <> and <>. And, chose any two Use Cases and create a Use Case scenario. The Use Case Scenario should define the interactions between the User and the System, and define any alternative or exceptional scenarios. Evaluation Criteria: Correct: Proper use of modeling notation, correct identification of key system use cases.
Consistent: Are the different use cases consistent with each other?
Unambiguous: Is the use case model clear? Are there any ambiguities, or aspects that can have multiple interpretations?
Complete: Does the model cover in sufficient depth the battle ship game?
Submission Guideline:
Submit a single PDF document
Code for previous assignment: import java.util.*; import java.lang.*; import java.io.*;
class Ideone{ public static int[][] board = new int[9][9]; public static int format=0; public static void printCoord(int x, int y){ char c = (char)(x+97); //Bellow, we are handling the input cases switch(format){ //(1,2) case 1: System.out.println("("+x+", "+y+")"); break; //1 2 case 2: System.out.println(x+" "+y); break; //1,2 case 3: System.out.println(x+","+y); break; //a2 case 4: System.out.println(c+""+y); break; //a 2 case 5: System.out.println(c+" "+y); break; } } //The method bellow will gather the corner adjacent points to allow them to be printed public static void printCornerAdjacent(int x, int y){ System.out.println("Corner Adjacent Points :"); int nextX, nextY; //Left Top corner nextX=x-1; nextY=y-1; if(nextX>=0 && nextY>=0){ printCoord(nextX, nextY); board[nextX][nextY]=1; } //Right Top corner nextX=x+1; nextY=y-1; if(nextX<9 && nexty>=0){ printCoord(nextX, nextY); board[nextX][nextY]=1; } //Left Down corner nextX=x-1; nextY=y+1; if(nextX>=0 && nextY<9){ printCoord(nextX, nextY); board[nextX][nextY]=1; } //Right Down corner nextX=x+1; nextY=y+1; if(nextX<9 && nexty<9){ printcoord(nextx, nexty); board[nextx][nexty]=1; }>=0){ printCoord(nextX, nextY); board[nextX][nextY]=1; } //Right nextX=x+1; nextY=y; if(nextX<9){ printCoord(nextX, nextY); board[nextX][nextY]=1; } //Top nextX=x; nextY=y-1; if(nextY>=0){ printCoord(nextX, nextY); board[nextX][nextY]=1; } //Down nextX=x; nextY=y+1; if(nextY<9){ printCoord(nextX, nextY); board[nextX][nextY]=1; } } //The mthod bellow will gather the information for the non adjacent at all and allow it to be printed public static void printNonAdjacent(){ System.out.println("Non Adjacent Points :"); for(int i=0; i<9; i++){ for(int j=0; j<9; j++){ if(board[i][j]==0) printCoord(i, j); } } } //bellow is the main method in which we will use to allow us to print everything public static void main (String[] args) throws java.lang.Exception{ for(int i=0; i<9; i++){ for(int j=0; j<9; j++) board[i][j]=0; } Scanner scanner = new Scanner( System.in ); System.out.println( "please enter some coordinates for the program: " ); System.out.println("(Any of the following formats are acceptable: (5, 5), 3 0, 4,1, a7, b 2)"); String s = scanner.nextLine(); int x=-1, y=-1; //x->row and t->column for(int i=0; i if(s.charAt(i) == '('){ format = 1; continue; } else if(s.charAt(i) == ')'){ if(format==1) continue; else{ System.out.println("Input format not supported!!!"); System.exit(0); } } else if(s.charAt(i) == ','){ if(format == 0) format = 3; continue; } else if(s.charAt(i) == ' ') continue; else if(s.charAt(i)>='a' && s.charAt(i)<='z'){ if(format == 0 && s.charAt(i+1)==' ') format = 5; else format = 4; int temp = s.charAt(i); if(x<0) x=temp-97; else y=temp-97; } else if(s.charAt(i)>='0' && s.charAt(i)<='8'){ int temp = s.charAt(i); if(x<0) x=temp-48; else y=temp-48; } else{ System.out.println("Input format not supported!!!"); System.exit(0); } } if(format == 0) format = 2; printCornerAdjacent(x, y); printEdgeAdjacent(x, y); printNonAdjacent(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
