Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INSTRUCTIONS For part 1 you need to create two classes: TicTac Toe Main a The Main class will only need one method: main. In main

image text in transcribed

image text in transcribed

image text in transcribed

INSTRUCTIONS For part 1 you need to create two classes: TicTac Toe Main a The Main class will only need one method: main. In main you must instantiate a local variable of type TicTacToe and call the printBoard method. The TicTacToe class should have a constructor and a printBoard method. TicTacToe should start off with one private instance variable, board, which is a two-dimensional array of CellStates (with 3 rows and 3 columns). In the TicTacToe constructor, make sure to assign one of the values in the board to CellState X and one to CellState. O (purely for testing purposes). CellState is an enum that has three values: X. O, and EMPTY I recommend defining CellState inside TicTacToe.java. You have permission to add other methods that may be useful. For instance, many students choose to write a short getCellText method that takes a CellState as input and returns one of three Strings: "X". which is useful since you don't want to print EMPTY when displaying your board. "0", or UML Diagram for TicTacToe Tictactoe - board : CellState10 > TicTacToe + printBoard() : void Compilation and Execution I will test your program as follows (assume both TicTacloe.java and Main.java are in the default folder javac *.java java Main Final Output After completing the next two parts of this assignment, interaction with the program will look like the following. Plan accordingly when writing your printBoard method: CAWindows\System32\cmd.exe - Player X's turn. Player X: Enter row (0, 1 or 2): 1 Player X: Enter column (e, 1 or 2): 1 X Player O's turn. Player 0: Enter row (e, 1 or 2): B Player 0: Enter column (0, 1 or 2): 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions