Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please follow all the instructions carefully. You must implement the classes as specified in the UML diagram. You may add other methods if needed, however,

Please follow all the instructions carefully. You must implement the classes as specified in the UML diagram. You may add other methods if needed, however, all the methods and the variables indicated in the UML diagram must be implemented. You must submit one zip file containing the source codes (.java files) and a text document with sample outputs. All your programs must be nicely formatted and commented. Develop the code in a step-by-step manner. Each correctly developed code piece will get you points. The objective of this assignment is to simulate a game of tic tac toe.

***THE FOLLOWING CLASSES MUST BE SUBMITTED: XO Class, Board Class, TicTacToeBoard, Play Class***

*I am using JGrasp so please make sure it is compatible *Please comment throughout code *FULL QUESTION IN IMAGES BELOWimage text in transcribedimage text in transcribed

Please follow all the instructions carefully. You must implement the classes as specified in the UML diagram. You may add other methods if needed, however, all the methods and the variables indicated in the UML diagram must be implemented You must submit one zip file containing the source codes (java files and a text document with sample outputs. All your programs must be nicely formatted and commented. Develop the code in a step-by-step manner. Each correctly developed c piece will get you points. The objective of this assignment is to simulate a game oftic tac toe. For those of you who are not familiar with the game you can check out the following website (http://www.exploratorium.edu/brain explorer/tictactoe.htm) Figure 1 below shows some sample tic toe toe boards with som e input. Win Co's Row Wine Oks Columnn Win X's Diagonal No winner Tie Fig. 1 Tic Tac Toe Boards and ways to win or tie (i.e., no winner) You will be using the concepts of inheritance and aggregation in object-oriented programming. You will also need to use 2-d arrays to represent the grid of the tic tac toe board. 2-d arrays are similar to 1-d arrays except that they use two indices. There is a small tutorial on 2-d arrays at the end of this assignment. Check it out. There are three main classes Board, TicTacToeBoard,Xo) and one additional class called Play that will use and run the classes (that is, play the game). See the UML diagram below to see how the classes fit together. Board Class rows in cols int Board (int, int) set methods et XO Class TicTacToeBoard Class board name: String Xo turncnt int static turn: int XO TicTacToeBoard (int, int) get/ set methods get/ set methods equals (XO): boolean add (int, int) boolean toString String boolean. Winner toString String other methods if needed xo Class this class will hold information about an "X" or an "o" object This class should have two attributes: a name (which is a String "X" or "O") and a static int variable that is either set to 0 or 1 (it should be initialized to 1). You will use this variable to determine which name to give the object when it is created (e.g., if it is 1, set the name to "X You need to implement a no args constructor that sets the name of the object to either X or O based on the static variable (and update the variable). You also need to implement the respective get and set methods an equals method to see if this XO object is the same as another XO object a toString method that returns the name of the XO object

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions