Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Question Says Create a class that keeps track of some statistics, including

ID: 3529253 • Letter: T

Question

The Question Says Create a class that keeps track of some statistics, including the score, of a bowling game.

A. Create a class called bowlingGame. Objects of this class represent a single game of bowling. Attributes of such an object include the name of bowler, current score and frame, and the number of strikes, spares, and gutter balls rolled so far in the game.

......................What I need to do is need help with a tranformer method called shot. It accepts an int parameter indicating the number of pins knocked down on the next "shot". The shot method should return a boolean indicating whether the current frame is over for the bowler. THis is my code so far for the shot method.



public boolean shot(int numOfPinsDown)
{

if (numOfPinsDown - NumOfPins == 10)
{
return true; //Returning a True Value means that the current Frame for the Bowler is over and will move to the Next Frame
}
else if (numOfPinsDown < 10 & numOfPinsDown > 0)
{
return false; //Returning a False Value means that the current Frame is still
}
return false;
} //END METHOD SHOT

Explanation / Answer

public boolean shot(int numOfPinsDown)
{
if (NumOfPins - numOfPinsDown == 0)
{
return true; //Returning a True Value means that the current Frame for the Bowler is over and will move to the Next Frame
}
else
{
NumOfPins = NumOfPins - numOfPinsDown;
return false; //Returning a False Value means that the current Frame is still
}
} //END METHOD SHOT

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote