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

this is a code is a class public int getFastestWin(){ return fastestWin; } publi

ID: 3532398 • Letter: T

Question

this is a code is a class

public int getFastestWin(){

return fastestWin;

} public int getGamesCompleted(){

return gamesCompleted;

(THERE IS NO SETTER AND I'M NOT ALLOWED TO MAKE ONE)

and this is how it works in the main method

System.out.println("Games Completed " + (player1.getGamesCompleted() - 1));

System.out.println("Fastest win: " + player1.getFastestWin());NE)

WORK BRILLIANTLY IF I DON'T HAVE TO RESET GAMES COMPLETED AND FASTESTWIN. HOWEVER, I DO.

IF I COULD USE player1.setGamesCompleted = 0, or player1.setFastestWin = 0, I would. I CAN'T MAKE A SETTER.

I've tried making integers set to getfastestwin and getgamescompleted and setting those to 0. NO LUCK.


any help is appreciated!

Explanation / Answer

One thing you can do is delete player1 and create a new player1 again like...

when you want to restart the counter, you write

player1= new player();

//this will create a new object and there by resetting the values to zero