Java Reference
In-Depth Information
PP 5.3
Design and implement an application that determines and prints
the number of odd, even, and zero digits in an integer value read
from the keyboard.
PP 5.4
Design and implement an application that plays the Hi-Lo guess-
ing game with numbers. The program should pick a random
number between 1 and 100 (inclusive), then repeatedly prompt
the user to guess the number. On each guess, report to the
user that he or she is correct or that the guess is high or low.
Continue accepting guesses until the user guesses correctly or
chooses to quit. Use a sentinel value to determine whether the
user wants to quit. Count the number of guesses and report that
value when the user guesses correctly. At the end of each game
(by quitting or a correct guess), prompt to determine whether the
user wants to play again. Continue playing games until the user
chooses to stop.
VideoNote
Developing a solution of
PP 5.4.
PP 5.5
Create a modified version of the PalindromeTester program so
that the spaces, punctuation, and changes in uppercase and low-
ercase are not considered when determining whether a string is a
palindrome. Hint : These issues can be handled in several ways.
Think carefully about your design.
PP 5.6
Using the Coin class defined in this chapter, design and imple-
ment a driver class called FlipRace whose main method creates
two Coin objects, then continually flips them both to see which
coin first comes up heads three flips in a row. Continue flipping
the coins until one of the coins wins the race, and consider the
possibility that they might tie. Print the results of each turn, and
at the end print the winner and total number of flips that were
required.
PP 5.7
Design and implement an application that plays the Rock-Paper-
Scissors game against the computer. When played between two
people, each person picks one of three options (usually shown by
a hand gesture) at the same time, and a winner is determined. In
the game, Rock beats Scissors, Scissors beats Paper, and Paper
beats Rock. The program should randomly choose one of the
three options (without revealing it), then prompt for the user's
selection. At that point, the program reveals both choices and
prints a statement indicating if the user won, the computer won,
or if it was a tie. Continue playing until the user chooses to stop,
then print the number of user wins, losses, and ties.
Search WWH ::




Custom Search