Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS 2 1 6 3 JAVA Assignment 4 Tic Tac Toe Assignment value: 4 0 points The assignment is a modification of Programming Exercise 8

CS 2163 JAVA
Assignment 4 Tic Tac Toe
Assignment value: 40 points
The assignment is a modification of Programming Exercise 8.9(Tic Tac Toe)
The program should first ask for the names of the two players. The program should then run
as a loop. As it is unfair for one player to always be X (and go first) alternate who gets to be
X and who gets to be O. Therefore, for each move the program should prompt the players by
name. As stated in the book, the program decides the outcome (X player wins, O player
wins, or tie game). Give a player 1 point for a win, and each gets (1)/(2) point for a tie game.
After each game, display the current score and ask the players if they want to play again.
How you handle this is up to you.
Include the following methods in your code:
public static void clearBoard()
// clears the board for a new game
public static void displayBoard()
// displays the current state of the board
public static void displayScore()
// display the current score
You may use other methods as you see fit, but do include the three above.
Variables used by several methods (such as the board) can be global.
This will turn out to be necessary once we start programming using GUIs.

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

More Books

Students also viewed these Databases questions

Question

Identify cultural barriers to communication.

Answered: 1 week ago