Please modify the following code to NOT have “TicTacToe extends Board” (I don’t want any extending)….

Please modify the following code to NOT have
“TicTacToe extends Board” (I don’t want any extending). Please
ensure the resulting code completes EACH part of
the following prompt:
“Your task is to create a game of Tic-Tac-Toe using a
2-Dimensional String array as the game board.
Start by creating a Board class that holds the
array. The constructor should use a traditional for-loop to fill
the array with “blank” Strings (eg. “-“). You may
want to include other instance data… Include the follwoing
methods: public void setSpace(int row, int col, String
s) will change a specific space to have either “X” or “O”,
but only if the space is available. public boolean
hasThree(String s) will check to see if there are 3 in a
row, column, or diagonal. public String toString()
will generate a String that displays the Board with appropriate
formatting. Create a driver class called TicTacToe
that instantiates a Board object and allows 2 players to go head to
head in a the game.”
public class Board {

//creating board

String board[][]=new String[3][3];

//construction to fill the board with string “-”

public Board() {

for(int i=0;i<3;i++) for(int j=0;j<3;j++) board[i][j]="-"; } } //creating class and extending board class public class TicTacToe extends Board{ //declaring variable boolean flag=false; static boolean plyr=true; //printing the board public String toString() { String result = ""; result += " | | n"; result += " " + board[0][0] + " | " + board[0][1] + " | " + board[0][2] + "n"; result += "_____|_____|_____n"; result += " | | n"; result += " " + board[1][0] + " | " + board[1][1] + " | " + board[1][2] + "n"; result += "_____|_____|_____n"; result += " | | n"; result += " " + board[2][0] + " | " + board[2][1] + " | " + board[2][2] + "n"; result += " | | n"; return result; } //creating main function public static void main(String args[]){ //declaring variable int row,col,choice; //initilizing empty symbol String symb=""; //scanner object to get input Scanner in=new Scanner(; //creating tictactoe object TicTacToe ttt=new TicTacToe(); //loop to get the input from the players do{ //printing option for the player System.out.println("1.Enter the X or O"); System.out.println("2.View Board"); System.out.println("0.Exit"); System.out.print("Select an option(0,1,2): "); //geting player response choice=in.nextInt(); if(choice==1){ //checking if the board is full then print msg and terminate the program if(!ttt.isFull()){ System.out.println("Board full"); break; } //Checking which player is about to play if(plyr==true){ System.out.println("Player 1 turn"); //assigning symbol for player 1 symb="X"; //changing the player for next turn plyr=!plyr; } else{ System.out.println("Player 2 turn"); //assigning symbol for player 1 symb="O"; //changing the player for next turn plyr=!plyr; } //asking player for location to insert symbol System.out.print("Enter row no: "); row=in.nextInt(); System.out.print("Enter column no: "); col=in.nextInt(); //inserting the symbol in the board ttt.setSpace(row,col,symb); } else if(choice==2){ //printing the board System.out.println(ttt.toString()); } else{ //informing user that selected option is invalid System.out.println("Selected option is invalid"); } //checking for winning situation if(ttt.hasThree(symb)==true){ System.out.println("WON!!!"); break; } //if choice is 0 then cancel the game }while(choice!=0); } //function to check that board is full boolean isFull(){ for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(board[i][j].equals("-")) flag=true; return flag; } //inserting the sybol to the board void setSpace(int row, int col, String s){ //insert if the location in board is empty or show the massage to player if(board[row][col].equals("-")) board[row][col]=s; else{ System.out.println("The space is already filled choose another"); plyr=!plyr; } } //checking for winning situation boolean hasThree(String s){ boolean win=false; //checking for rows winning situation if((board[0][0].equals(s)) && (board[0][1].equals(s)) && (board[0][2].equals(s))) win=true; else if((board[1][0].equals(s)) && (board[1][1].equals(s)) && (board[1][2].equals(s))) win=true; else if((board[2][0].equals(s)) && (board[2][1].equals(s)) && (board[2][2].equals(s))) win=true; //checking for column winning situation else if((board[0][0].equals(s)) && (board[1][0].equals(s)) && (board[2][0].equals(s))) win=true; else if((board[0][1].equals(s)) && (board[1][1].equals(s)) && (board[2][1].equals(s))) win=true; else if((board[0][2].equals(s)) && (board[1][2].equals(s)) && (board[2][2].equals(s))) win=true; //checking for diagonal winning situation else if((board[0][0].equals(s)) && (board[1][1].equals(s)) && (board[2][2].equals(s))) win=true; else if((board[0][2].equals(s)) && (board[1][1].equals(s)) && (board[2][0].equals(s))) win=true; else win=false; return win; } }

Elite Writer Help
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.


Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.


Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.


Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.


Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.