Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Write a class called SBoard that represents a 10x 10 grid , where a token may be placed at any Irow , column ) coordinates . It should have two data...

Need help with C++ homework

I need a function which outputs the number of squares after the last token is dropped. placeToken returns 4 etc.

  • Attachment 1
  • Attachment 2
Write a class called SBoard that represents a 10x 10 grid , where a token may be placed at any Irow , column ) coordinates .It should have two data members : a 2 D array of char for the grid , and an int to keep track of how many tokens have been placed .It should have a default constructor that initializes all elements of the array to being empty ( you can use whatever characters you want torepresent that a square is empty or has a token ) , and also initializes the number of tokens placed ( at the beginning there are no tokens onthe board ) .It should have a method named get NumTokens that returns the number of tokens placed so far .*It should have a method named place Token that takes two ints ( the row and column , in that order ) . If that location already has a token , orif the row or column are out of the range 0 - 9 , then a token should not be placed and the method should return - 1 . Otherwise , a token*should be placed there and the method should return the number of squares completed by placing that taken ( where only the four cornersare needed to complete a square ) . For example , if we have the following grid , where* marks each existing token :"then playing a token at the spot marked # will complete four squares - a 2x 2 , a 3 x3 , 2 4x4 , and a 5 x 5 ( 1 x 1 doesn't count ) .It should have a method named read Placements From File that takes a string ( the name of the file to read ) . The file will have the followingformat ."I ]2 3I LAN {7 3Where the left number on each line is the row and the right number is the column . The method should place a token at the coordinates*given in each row of the file . To do this , it will call the place Token method "ignoring the return value ) . Remember to close the file .It's not required , but you'll probably find it useful for testing and debugging to have a method that prints out the board .Whether you think of the array indices as being [ now ] [ column ] or [ column ] [ row ] doesn't matter as long as you're consistent .The files must be named : 5Board . hipp and SBoard . cop .
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question