Client.java - package assignments Title ICT167 Assignment 1 Question 1 Author Tan Kok Hao Antonia Student No 33489037 Date 24 February 2019 File Name

Client.java - package assignments Title ICT167 Assignment 1...

This preview shows page 1 - 2 out of 2 pages.

package assignments; /* Title: ICT167 Assignment 1 Question 1 Author: Tan Kok Hao Antonia Student No: 33489037 Date: 24 February 2019 File Name: hangManDemo.java Purpose: */ import java.util.Scanner; public class Client { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String userInput; char ch; System.out.println(studentInfo()); for(int count=1;count<=3;count++) { hangMan game = new hangMan(count); System.out.println("Let's play "+count+" round of hangman."); System.out.println("We are playing hangman"); while(!game.isFound()) { System.out.println("\nThe disguised word is : <"+game.getDisguisedWord()+">"); System.out.println("Guess a letter: "); userInput = kb.nextLine(); ch=userInput.charAt(0); if(!game.validateMultiCharInput(userInput)) { System.out.println("Sorry, bad guess. Need a single letter."); System.out.println("Guesses made "+game.getGuessCount()+" with "+game.getIncorrectCount()+" wrong"); } else if(!game.validateSingleCharInput(ch)) { System.out.println("Sorry, your guess must be an alphabet
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • One '14
  • English-language films, Void type, Secret

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture