Consider a class that could be used to play a game of

Assignment Help JAVA Programming
Reference no: EM13380065

Consider a class that could be used to play a game of hangman. The class has the following attributes:

  • The secret word
  • The disguised word, 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 , and b have been guessed, the disguised word would be ab?a?a?ab?a
  • The number of guesses made
  • The number of incorrect guesses

It will have the following methods:

  • MakeGuess(c) guesses that character c is in the word
  • getDisguisedWord returns a string containing correctly guessed letters in their correct positions and unknown letters replaced with ?
  • getSecretWord returns the secret word
  • getGuessCount returns the number of guesses made
  • isFound returns true if the hidden word has been discovered.

Perform the following actions:

  • Write a method heading for each method.
  • Write preconditions and postconditions for each method.
  • Write some Java statements that test the class.
  • Implement the class.
  • List any additional methods and attributes needed in the implementation that were not listed in the original design. List any other changes made to the original design.
  • Write a program that implements the game of handgman, using the class you wrote for part d.

Reference no: EM13380065

Questions Cloud

Part 11 how many cells can be in a computers main memory if : part 11. how many cells can be in a computers main memory if each cells address can be represented by two hexadecimal
Question 1write a recursive method nmbdigits which takes an : question 1write a recursive method nmbdigits which takes an integer value as parameter and returns the number of digits
Project specificationerp project implementation atoledo : project specificationerp project implementation atoledo pizza company is planning to implement a new erp system. tim
1online bankingwhat special consequences do you foresee : 1.online bankingwhat special consequences do you foresee from information security breaches confined to online retail
Consider a class that could be used to play a game of : consider a class that could be used to play a game of hangman. the class has the following attributesthe secret wordthe
Define a class called counter an object of this class is : define a class called counter. an object of this class is used to count things so it records a count that is a
Problem 1 write a program that prints a multiplication : problem 1 write a program that prints a multiplication table like this 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3
Problem1 the fibonacci numbers are defined by the : problem1 the fibonacci numbers are defined by the sequencef1 1 f2 1 fn fn-1 fn-2.reformulate that asfold1 1 fold21
This assignment will focus on creating java servlets that : this assignment will focus on creating java servlets that can not only serve html to web users but also provide a web

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement a card game in java

In this assignment, you will be asked to implement a card game. You will need to make several design decisions for your code. It will be expected that all classes you write will utilize the principle of encapsulation.

  Write a class that reads a file

In java, write a class that reads a file and outputs a list of the unique words in the file and the number of times each unique word occurs.Hint: use a HashMap with keys being the words and values being integer counts associated with the words.

  Determine the type of moped

Write a driver class called MopedRental. This class should perform the following: asks the user to enter the size of the moped, the day of the week and the number of hours rented, creates the Moped object, based on the size, and displays the input..

  Variable of type string that has been assigned

Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consisting of the last three characters of the value word. So if if the value if word were "biggest" the expression's value w..

  Requests 2 numbers from the user and then passes

Write a program in java that requests 2 numbers from the user and then passes these 2 numbers to a method findMax that displays the largest number. Make sure your method is called fron main(). Test the method by passing various data to it

  Create a java class called samearraysexception

Create a Java class called SameArraysException that extends the Exception class.

  Quadratic that solves quadratic equations

Write a method called quadratic that solves quadratic equations and prints their roots. Recall that a quadratic equation is a polynomial equation in terms of a variable x of the form ax2 + bx + c = 0. The formula for solving a quadratic equation is ?..

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

  Write a program that will calculate monthly pay

Write a program that will calculate monthly pay and expenses for a commercial utility sales person. Sales employees in this company are paid monthly. Each employee is paid a base pay of $1,000 and 9½ % commission on sales. The company deducts 18% of..

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Make a fourth button called special

Make a fourth button called "special" that does something else notdescribed in the assignment, such as change the background color.

  Write a java program to read sequences of integers

Write a Java program to read sequences of integers from a text file, build a binary search tree for each sequence by inserting numbers in the sequence one after another into the search tree, and plot a picture of the finished tree.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd