Java Reference
In-Depth Information
PP 5.8 Design and implement an application that simulates a simple slot
machine in which three numbers between 0 and 9 are randomly
selected and printed side by side. Print an appropriate statement
if all three of the numbers are the same, or if any two of the
numbers are the same. Continue playing until the user chooses to
stop.
PP 5.9 Design and implement a program that counts the number of inte-
ger values in a text input file. Produce a table listing the values
you identify as integers from the input file.
PP 5.10 Modify the Die class from Chapter 4 so that the setFaceValue
method does nothing if the parameter is outside of the valid
range of values.
PP 5.11 Modify the Account class from Chapter 4 so that it performs
validity checks on the deposit and withdraw operations.
Specifically, don't allow the deposit of a negative number or a
withdrawal that exceeds the current balance. Print appropriate
error messages if these problems occur.
PP 5.12 Modify the StyleOptions program in this chapter to allow the
user to specify the size of the font. Use a text field to obtain the
size.
PP 5.13 Design and implement a program to process golf scores. The
scores of four golfers are stored in a text file. Each line represents
one hole, and the file contains 18 lines. Each line contains five
values: par for the hole followed by the number of strokes each
golfer used on that hole. Determine the winner and produce a
table showing how well each golfer did (compared to par).
PP 5.14 Design and implement a program that compares two text input
files, line by line, for equality. Print any lines that are not equiva-
lent.
PP 5.15 Design and implement a program that counts the number of
punctuation marks in a text input file. Produce a table that
shows how many times each symbol occurred.
PP 5.16 Develop a simple tool for calculating basic statistics for a seg-
ment of text. The application should have a single window with
a scrolling text box (a JTextArea ) and a stats box. The stats box
should be a panel with a titled border, containing labeled fields
that display the number of words in the text box and the average
word length, as well as any other statistics that you would like
Search WWH ::




Custom Search