You must have played this 2 player game, in which there are 9 holes where one player mark Cross and the other Player places Ovals in the game and there are multiple situations at the end of the game in which are as follows. 1. Player 1 wins if he became able to mark 3 Cross in any of the row. 2. Player 1 wins if he became able to mark 3 Cross in any of the column. 3. Player 1 wins if he became able to mark 3 Cross in any of the diagonals of the holes. 4. Player 2 wins if he became able to mark 3 Ovals in any of the row. 5. Player 2 wins if he became able to mark 3 Ovals in any of the column. 6. Player 2 wins if he became able to mark 3 Ovals in any of the diagonals of the holes. 7. Match is drawn if all holes are filled but no one could win. Now what is requirement by your side, you have to write a Java program described below 1. Create 9 variables of type integer with names given below, which will act like the holes of the game. a. hole1, hole2, hole3, hole4, hole5, hole6, hole7, hole8 and hole9 2. Now take input in these 9 variables from user using the scanner but restrict them to input only 1 or 0, this 1 will represent the Cross and 0 will represent as Oval, if someone enters a number other than 0 and1, your program should give an appropriate message and then terminated. 3. When you have 9 numbers as 0 and 1, check all the situations and announce the results, either Player 1 wins or Player 2 wins or game is draw. Note: You must solve the above problem using Decision Structures. You are not allowed to use Loops. You do not have to enter any state where both player 1 and player 2 wins. You do not have to consider that condition when a player can win before going to all 9 values. You just have to follow the instructions where you have to declare winner after the 9 iterations.By using java language
You must have played this 2 player game, in which there are 9 holes where one player mark Cross and the other
Player places Ovals in the game and there are multiple situations at the end of the game in which are as follows.
1. Player 1 wins if he became able to mark 3 Cross in any of the row.
2. Player 1 wins if he became able to mark 3 Cross in any of the column.
3. Player 1 wins if he became able to mark 3 Cross in any of the diagonals of the holes.
4. Player 2 wins if he became able to mark 3 Ovals in any of the row.
5. Player 2 wins if he became able to mark 3 Ovals in any of the column.
6. Player 2 wins if he became able to mark 3 Ovals in any of the diagonals of the holes.
7. Match is drawn if all holes are filled but no one could win.
Now what is requirement by your side, you have to write a Java program described below
1. Create 9 variables of type integer with names given below, which will act like the holes of the game.
a. hole1, hole2, hole3, hole4, hole5, hole6, hole7, hole8 and hole9
2. Now take input in these 9 variables from user using the scanner but restrict them to input only 1 or 0,
this 1 will represent the Cross and 0 will represent as Oval, if someone enters a number other than 0 and1, your program should give an appropriate message and then terminated.
3. When you have 9 numbers as 0 and 1, check all the situations and announce the results, either Player 1
wins or Player 2 wins or game is draw.
Note:
You must solve the above problem using Decision Structures. You are not allowed to use Loops.
You do not have to enter any state where both player 1 and player 2 wins.
You do not have to consider that condition when a player can win before going to all 9 values.
You just have to follow the instructions where you have to declare winner after the 9 iterations.By using java language
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images