Question: BattleShip.java by JOptionPane SECTION 3 Problem Description Battleship Game: brief description: Historically battleship was played on a game cate that con- sisted of a pegboard
SECTION 3 Problem Description Battleship Game: brief description: Historically battleship was played on a game cate that con- sisted of a pegboard so that you could track where you shops were and the shots you were making into your opponents feet OBIECTIVE Pegboards lend themselves quite nicely to representation by array. So to give you a chance to review all of the program ming basics such an array if-else statements and writing the hom methods (function etc... you will be implement the code that will initialize a battleship game board with a single 5 unit long ship positioned randomly but legally within the confines of the same board. For example 1. Review if-else statements 2. Work with a program loop 3. Work with Darray 4. Transition to Java's Random number enerator team and is the showOptionDialog stativ method from the JOptionPate class 6. Work with static methods and statie variables. Or You should be able to see that the board should be displayed sint a JOptionPane.show Options Dialog box. The syntax for this is given Section of this document. If you don't want to bother with a custom icon, simply enter null as an argument where you would have passed the icon I will give you a rather large degree of freedom in how you wish to implement this with the few general requirements given below 1. There must be a program loop to generate random boards until the ser wants to quite 2. The same board must use a 2 array that is randomly pope- lated with this single ship 3. All methods and variables outside of metads must be statie (we will get to non-static woon enough. You need to Inam about both 4. You must adhere to the programming convention specie fied in the evaluation criteria table shown in the next see tion This font assignment is rife with Extra credit potential! De more than one ship of varying length(careful, no over- law allowed) Allow the ser to select ship length is a bearde. Sa, the place to start is the pseudocode. And to do that you need to do problem decomposition What are your ga? What does the user need to input What needs to be processed? What needs to be output? Start asking yourself questions and if you can then, ask me or a la mate And you are required to submit you pseudo code in proper podo code convention along with your source code Lines numbered Proper indentation to show logical structure and nesting No programming code allowedt User everyday English . Use REPEAT and END REPEAT for Us IF THE OTHERWISE for decisione If you have any questions ASK SECTION 3 Problem Description Battleship Game be description History battleship was played on a game that con sisted of a pegboard so that you could track where you shops were and the shots you were making into your opponents Teg boarded themselves quite nicely to representation by y So to give you a chance to view all of the program bus such as my, if-else statements and writing cus bommode (function, you will be implement the code that will initiale a battleship game board with a single to ship positioned randomly but legally within the confines of the same board. For example OLTECTIVE Review if he statements 2. Work with a program loop 3. Work with 2D amis 4. Transition to Java's Random number generator 5. Learn and use the showOption Dulog static method from the JOptionPane class 6. Work with static methods and static variables Or You should be able to see that the board should be displayed using Option Pane.show Options Dialog box. The wyntax for this is given Section of this document. If you don't want to bother with a custom con, simply enter nullas antgament where you would have passed the con I will give you a rather large degree of freedom in how you wish to implement this with the few general requirements given below 1. There must be a program loop to generate random boards until the user wants to quite 2. The game board must use a Dantay that is randomly popo- lated with this single ship 3. All methods and variables outside of methods must be static (we will get to non-station enough). You need to learn about both 4. You must adhere to the programming conventioned fied in the evaluation criteria table shown in the next sec tons This first assignment is nife with tra credit potential Do more than one ship of varying length(careful, to over laps allowed) Se the place to start is the pseudocode. And to do that you need to do problem decomposition What are your ins? What does the user need to input? What needs to be processed What needs to be output? Start asking your questions and if you can't awer them me or acmate And you are required to submit you pseudo code in proper pecado code convention along with your source code - Les numbered Proper indentation to show logical structure and resting No programming code allowed everyday ish . Une REPEAT and END REPEAT for Loops Use IF THE OTHERWISE for decisione If you have any questions AS Allow the user to select ship length site or boards SECTION 3 Problem Description Battleship Game: brief description: Historically battleship was played on a game cate that con- sisted of a pegboard so that you could track where you shops were and the shots you were making into your opponents feet OBIECTIVE Pegboards lend themselves quite nicely to representation by array. So to give you a chance to review all of the program ming basics such an array if-else statements and writing the hom methods (function etc... you will be implement the code that will initialize a battleship game board with a single 5 unit long ship positioned randomly but legally within the confines of the same board. For example 1. Review if-else statements 2. Work with a program loop 3. Work with Darray 4. Transition to Java's Random number enerator team and is the showOptionDialog stativ method from the JOptionPate class 6. Work with static methods and statie variables. Or You should be able to see that the board should be displayed sint a JOptionPane.show Options Dialog box. The syntax for this is given Section of this document. If you don't want to bother with a custom icon, simply enter null as an argument where you would have passed the icon I will give you a rather large degree of freedom in how you wish to implement this with the few general requirements given below 1. There must be a program loop to generate random boards until the ser wants to quite 2. The same board must use a 2 array that is randomly pope- lated with this single ship 3. All methods and variables outside of metads must be statie (we will get to non-static woon enough. You need to Inam about both 4. You must adhere to the programming convention specie fied in the evaluation criteria table shown in the next see tion This font assignment is rife with Extra credit potential! De more than one ship of varying length(careful, no over- law allowed) Allow the ser to select ship length is a bearde. Sa, the place to start is the pseudocode. And to do that you need to do problem decomposition What are your ga? What does the user need to input What needs to be processed? What needs to be output? Start asking yourself questions and if you can then, ask me or a la mate And you are required to submit you pseudo code in proper podo code convention along with your source code Lines numbered Proper indentation to show logical structure and nesting No programming code allowedt User everyday English . Use REPEAT and END REPEAT for Us IF THE OTHERWISE for decisione If you have any questions ASK SECTION 3 Problem Description Battleship Game be description History battleship was played on a game that con sisted of a pegboard so that you could track where you shops were and the shots you were making into your opponents Teg boarded themselves quite nicely to representation by y So to give you a chance to view all of the program bus such as my, if-else statements and writing cus bommode (function, you will be implement the code that will initiale a battleship game board with a single to ship positioned randomly but legally within the confines of the same board. For example OLTECTIVE Review if he statements 2. Work with a program loop 3. Work with 2D amis 4. Transition to Java's Random number generator 5. Learn and use the showOption Dulog static method from the JOptionPane class 6. Work with static methods and static variables Or You should be able to see that the board should be displayed using Option Pane.show Options Dialog box. The wyntax for this is given Section of this document. If you don't want to bother with a custom con, simply enter nullas antgament where you would have passed the con I will give you a rather large degree of freedom in how you wish to implement this with the few general requirements given below 1. There must be a program loop to generate random boards until the user wants to quite 2. The game board must use a Dantay that is randomly popo- lated with this single ship 3. All methods and variables outside of methods must be static (we will get to non-station enough). You need to learn about both 4. You must adhere to the programming conventioned fied in the evaluation criteria table shown in the next sec tons This first assignment is nife with tra credit potential Do more than one ship of varying length(careful, to over laps allowed) Se the place to start is the pseudocode. And to do that you need to do problem decomposition What are your ins? What does the user need to input? What needs to be processed What needs to be output? Start asking your questions and if you can't awer them me or acmate And you are required to submit you pseudo code in proper pecado code convention along with your source code - Les numbered Proper indentation to show logical structure and resting No programming code allowed everyday ish . Une REPEAT and END REPEAT for Loops Use IF THE OTHERWISE for decisione If you have any questions AS Allow the user to select ship length site or boards
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
