Programming Homew...
Follow
Find
13.0K views | +0 today
 
Scooped by CramShark
onto Programming Homework Help
Scoop.it!

Hangman Java Program | CramShark

Hangman Java Program | CramShark | Programming Homework Help | Scoop.it
Hangman Java Program Solution

 

Write a Java class, Hangman, that can be used to play the game of Hangman. See a sample run of this game in
the file attached to this assignment named, GameOutput.pdf. Output from your application should be very
similar. Here is what your Hangman class should contain:
Five Attributes (instance variables):
• the secret word, a private String variable
• the disguised word, a private String variable, in which each unknown letter in the secret word is
replaced with a question mark (?). For example, if the secret word is abracadabra, and the letters a, b,
and e have been guessed, then the disguised word is displayed as ab?a?a?ab?a.
• the letters, in alphabetical order, that have been incorrectly guessed; a private String variable
• the number of guesses made so far, an int variable
• the number of incorrect guesses made so far, an int variable
Five Methods:
• initialize: a public void method that takes one String parameter as the secret word and initializes the
secret word and other instance variables to begin playing a round of Hangman.
• makeGuess: a private void method that accepts a parameter of type, char, and responds appropriately
to the guess that character, c, is in the secret word. This involves counting the guess, counting
incorrect guesses, recalculating the disguised word if the guess is correct, adding the character to the
letters guessed incorrectly (alphabetically) if the guess is incorrect, etc.
• accessor methods for the secret word and the disguised word: getSecretWord and getDisguisedWord
• boolean‐returning method, isFound, returns true if the secret word has been guessed
You may add other methods and/or instance variables to assist in implementing the game of Hangman. Be
sure that the output of you game looks much like the same output in GameOutput.pdf, except that your
application should work for any word chosen as the secret word. Your Hangman class should use a main
method as follows in order to play the game:
public static void main(String[] args) {
Hangman game = new Hangman();
game.initialize("Happiness");
System.out.println("Lets play a round of hangman.");
game.playGame();
}
Note that this application does not pick a truly secret word since the programmer chooses the word ahead of
time. This problem can easily be solved once we know how to read files. For now, having the programmer
choose the word this way will be fine, just make sure your code works for many different words.

more...
No comment yet.
Programming Homework Help
Online programming homework help including Java and C#
Curated by CramShark
Your new post is loading...
Your new post is loading...
Scooped by CramShark
Scoop.it!

Java - Java SE 8 Date and Time | CramShark

Java - Java SE 8 Date and Time | CramShark | Programming Homework Help | Scoop.it
Java - Java SE 8 Date and Time Solution - Java 1.0 had a Date class that was just awful (ask me!) and most of its methods were deprecated in Java 1.1 when a Cal
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Student Grades | CramShark

Java - Student Grades | CramShark | Programming Homework Help | Scoop.it
Java - Student Grades Solution - (Grades) Create a blueprint named Student that has two fields, a String for their name and a one-dimensional array of integers
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Product and ProductDriver | CramShark

Java - Product and ProductDriver | CramShark | Programming Homework Help | Scoop.it
Java - Product and ProductDriver Solution - Problem #1 (Product and ProductDriver)
A mail order house sells five products whose retail prices are as follows:
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java ArrayList | CramShark

Java ArrayList | CramShark | Programming Homework Help | Scoop.it
Java ArrayList Solution - The following code creates a simple ArrayList:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStr
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Javascript - Monthly Balance Calculator and Dice Roller | CramShark

Javascript - Monthly Balance Calculator and Dice Roller | CramShark | Programming Homework Help | Scoop.it
Javascript - Monthly Balance Calculator and Dice Roller Solution - ---Monthly Balance Calculator:
Operation

This application allows the user to enter de
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Vampire | CramShark

Java - Vampire | CramShark | Programming Homework Help | Scoop.it
Java - Vampire Solution - For my homework, I need to make a vampire game that sucks blood. My homework needs to practice three things: arrays, classes, and inhe
more...
No comment yet.
Scooped by CramShark
Scoop.it!

JAVA PROGRAMMING ASSIGNMENT 12 | CramShark

JAVA PROGRAMMING ASSIGNMENT 12 | CramShark | Programming Homework Help | Scoop.it
JAVA PROGRAMMING ASSIGNMENT 12 Solution - Lab Assignment



This lab assignment will ask you to write a program using an ArrayList.



Exercise 1
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - ArrayList Demo | CramShark

Java - ArrayList Demo | CramShark | Programming Homework Help | Scoop.it
Java - ArrayList Demo Solution - Exercise 1



1. Create a New Project named ArrayListDemo and copy the file ArrayListDemo.java into the project.
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Payroll | CramShark

Java - Payroll | CramShark | Programming Homework Help | Scoop.it
Java - Payroll Solution - Design and write a “payroll” program that asks the user for the number of hours worked and the hourly wage, and then compu
more...
No comment yet.
Scooped by CramShark
Scoop.it!

C++ - Classes and Data Abstraction | CramShark

C++ - Classes and Data Abstraction | CramShark | Programming Homework Help | Scoop.it
C++ - Classes and Data Abstraction Solution - Typically, everyone saves money periodically for retirement, buying a house, or for some other purpose. If you ar
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Body Mass Index | CramShark

Java - Body Mass Index | CramShark | Programming Homework Help | Scoop.it
Java - Body Mass Index Solution - Design and write a BMI (body-mass index) program. BMI is a simplistic measure that insurance companies sometimes use to calcul
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Race Report | CramShark

Java - Race Report | CramShark | Programming Homework Help | Scoop.it
Java - Race Report Solution - Assume you are volunteering for a local track association, which would like a program that can print out a
report for a race. A
more...
No comment yet.
Scooped by CramShark
Scoop.it!

JAVA PROGRAMMING ASSIGNMENT 10 | CramShark

JAVA PROGRAMMING ASSIGNMENT 10 | CramShark | Programming Homework Help | Scoop.it
JAVA PROGRAMMING ASSIGNMENT 10 Solution - Lab Assignment



This lab assignment will ask you to write a program using text files.



Exercise 1
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Airplane Seats - 2D Array | CramShark

Java - Airplane Seats - 2D Array | CramShark | Programming Homework Help | Scoop.it
Java - Airplane Seats - 2D Array Solution - Problem #4. (2-D ARRAY) We have an airplane that has seven rows and four seats per row. Have the program display t
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Variable-Length Argument Lists and Command line arguments | CramShark

Java - Variable-Length Argument Lists and Command line arguments | CramShark | Programming Homework Help | Scoop.it
Java - Variable-Length Argument Lists and Command line arguments Solution - Look at sections 7.13 and 7.14 in the 10th edition. These will be on the certificat
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Computer | CramShark

Java - Computer | CramShark | Programming Homework Help | Scoop.it
Java - Computer Solution - Develop a Computer class that describes your computer. The class must have at least five attributes comprised of a minimum of three d
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Inventory | CramShark

Java - Inventory | CramShark | Programming Homework Help | Scoop.it
Java - Inventory Solution - For this homework you will re-factor the Inventory management program from HW 7.
This assignment will give you practice with objec
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Dictionary and DictionaryWord | CramShark

Java - Dictionary and DictionaryWord | CramShark | Programming Homework Help | Scoop.it
Java - Dictionary and DictionaryWord Solution - Project 3
CMIS 141
Requirements Write a program that will serve as an interactive dictionary allowing a use
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Farmers Market | CramShark

Java - Farmers Market | CramShark | Programming Homework Help | Scoop.it
Java - Farmers Market Solution - Farmers Market: Write a Java program to perform check-out functionality for a simple Farmers Market store with exactly 5 produc
more...
No comment yet.
Scooped by CramShark
Scoop.it!

JAVA PROGRAMMING ASSIGNMENT 11 | CramShark

JAVA PROGRAMMING ASSIGNMENT 11 | CramShark | Programming Homework Help | Scoop.it
JAVA PROGRAMMING ASSIGNMENT 11 Solution - Lab Assignment



This lab assignment will ask you to write a program using recursion.



Exercise 1
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Recursions Methods | CramShark

Java - Recursions Methods | CramShark | Programming Homework Help | Scoop.it
Java - Recursions Methods Solution - Exercise 1



1. Create a New Project named ArithmeticProgression and copy the file ArithmeticProgression.java into t
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Search Engine | CramShark

Java - Search Engine | CramShark | Programming Homework Help | Scoop.it
Java - Search Engine Solution - Java collection framework
The helper files: Main, SearchEngine, HTMLTokenizer, and the interface WordIndex.
Our search engine
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Find Anagrams | CramShark

Java - Find Anagrams | CramShark | Programming Homework Help | Scoop.it
Java - Find Anagrams Solution - See Project 4 on pg. 821 for the basic ideas of this project. We will find the longest anagrams in the words.txt provided in the
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Greeter | CramShark

Java - Greeter | CramShark | Programming Homework Help | Scoop.it
Java - Greeter Solution - Design and write a "greeter" program that asks the user for his or her name, and then displays "Welcome to Java,"
more...
No comment yet.
Scooped by CramShark
Scoop.it!

Java - Rock Paper Scissors | CramShark

Java - Rock Paper Scissors | CramShark | Programming Homework Help | Scoop.it
Java - Rock Paper Scissors Solution - For this assignment, you will use Java’s control-flow constructs to write a simple two-player game. The game
you w
more...
No comment yet.