Java level 1 programming assignments

Asignments/Object Oriented Programming Problem Set.docx Problem 4: Define a class called Counter. An object of this class is used to count things so it records a count that is a non-negative whole number. Include methods to set the counter to 0, to increase the counter by 1, and to decrease the counter by 1. Be sure that no method allows the value of the counter to become negative. Also include an accessor method that returns the current count value, as well as a method that displays the count on the screen. Do not define an input method. The only method that can set the counter is the one that sets it to zero. Write a program to test your class definition. (Hint: you need only one instance variable). Problem 5: 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. Problem 6:…

Don't use plagiarized sources. Get Your Custom Essay on
Java level 1 programming assignments
Just from $13/Page
Order Essay
Calculator

Calculate the price of your paper

Total price:$26
Our features

We've got everything to become your favourite writing service

Need a better grade?
We've got you covered.

Order your paper