GameDemo

GameDemo - } if(g.winGame()){winCount++;...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; public class GameDemo { public static void main(String argv[]) { Game g = new Game(); g.playGame(); int winCount = 0; int lossCount = 0; for(boolean keepPlaying = true; keepPlaying==true;){ if(!g.winGame()){lossCount++; System.out.println("Oops. You got killed. Do you want to play again? (y/n)");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } if(g.winGame()){winCount++; System.out.println("You win. Do you want to play again? (y/n)"); } Scanner keyboard = new Scanner(System.in); String s = keyboard.next(); if(s.equals("y"))new Game().playGame(); else System.out.println(winCount + " wins and " + lossCount + " losses."); } } }...
View Full Document

Ask a homework question - tutors are online