BattleShip HW help (please)

I'm doing homework and yes I know it's shameful but I wanted to see if I can get some help, i'll post what I got but really I would like some assistance. I know asking for help on these questions are shameful but really please, especially on question 14. If I need to post the entire code ill do so. I'm currently working on it at the moment right now.

QUESTION 14.
Declare a method named checkWinner that does the following:
1. It has no arguments.
2. It counts the number of board cells that do not have the SPACE character in them.
3. It returns true if count equals 0(zero) and returns false if count is not equal to 0(zero).



QUESTION 6.
1. Declare a floating point variable named points
2. Declare a floating point variable named penalties

1
2
float points; 
float penalties; 


QUESTION 7
Declare a method named reset that does the following:
1. It sets the value of the variable points to zero (0).
2. It sets the value of the variable penalties to zero (0).
3. It does not return a value.


1
2
3
4
void reset(){ 
points = 0; 
penalties = 0; 
} 



Declare a method named PenaltyPoints that does the following:
1. It has a single argument named value that is a floating point number.
2. It adds the value of the argument value to the variable penalties.
3. It returns the value of the variable penalties.

1
2
3
4
float PenaltyPoints(float value){ 
value + penalties; 
return (penalties); 
} 

QUESTION 11. (6 Points)
1. Declare a character array variable named board whose number of elements is MAXSQUARES.
2. Declare a boolean variable named HitFlag.

/Place Code Here
1
2
int board[MAX_SQUARES = 9]; 
bool HitFlag; 

public:


QUESTION 12. (6 Points)
Create a method named Reset() that does the following:
1. It has no arguments.
2. It initializes each element of the array variable board to equal the value SPACE.
3. It returns nothing.


1
2
3
void Reset(string EMPTY = ' '){ 
MAX_SQUARES = EMPTY; 
} 

QUESTION 15. (6 Points)
The method getShipLocation()does the following:
1. It has no arguments.
2. It prompts the Player to "Enter Ship Location: " and then reads the value entered from the keyboard. If the value entered is illegal, prompt the Player to try again to enter a valid value.
3. It returns the location entered by the Player.



QUESTION 16. (6 Points)
The method getMove()does the following:
1. It has no arguments.
2. It prompts the Player with "\nYour Move Human: " and then reads the value entered from the keyboard. If the value entered is illegal, prompt the Player to try again to enter a valid value.
3. It returns the move entered by the Player.




QUESTION 17. (6 Points)
Create a method named getRandomMove() that does the following:
4. It has no arguments.
5. It generates a random number between 0(zero)
and 8 (MAXSQUARES - 1) for the computerPlayer
Topic archived. No new replies allowed.