Question
Code the following in Java Use may use only the following concepts as needed: Single Dimension Arrays, Multi-Dimension Arrays, Methods, Loops, Post/Pre Fix Operations, Static
Code the following in Java
Use may use only the following concepts as needed: Single Dimension Arrays, Multi-Dimension Arrays, Methods, Loops, Post/Pre Fix Operations, Static vs Non-Static and Random numbers.
Part I
Tic Tac Toe is a very popular game played by many children all over the world. The grid of which the game is played on is like the 2D representation of a multi-dimensional array. You will re-create this game using your knowledge of arrays, methods and loops. The board of the game will be created using a multi-dimensional array. A nested for loop will be used to initialize the multi-dimensional array with the value (a dash). You will have a method for each of the following:
Determine a winner diagonally Determine a winner horizontally Determine a winner vertically Print the game board to the console Change the turn of the player The player move Determine the computer random move Find a resource online that explains how the game is constructed and played. This will be your documentation. Add the link to your comments.
Be sure and comment every line to explain your code.
Part II
Create a programming scenario where the post-fix and the pre-fix operators impact the value of a variable. Using the same scenario, the value of the variable is different when using the post-fix operation versus the pre-fix operation.
Part III
Explain static vs non-static methods. Why we need the key word static for some methods and not for others?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started