Java Reference
In-Depth Information
Write a static method that takes a year as a parameter and returns true
if the year is a leap year, and false otherwise.
1.18
PROGRAMMING PROJECTS
1.19
Write a program to determine all pairs of positive integers,
(
ab
,
)
,
such that
ab 1000
<<
and
(
a 2
++
b 2
1
)
()
ab
is an integer.
Write a method that prints the representation of its integer parameter
as a Roman numeral. Thus, if the parameter is 1998 , the output is
MCMXCVIII .
1.20
Suppose you want to print out numbers in brackets, formatted as
follows: [1][2][3] , and so on. Write a method that takes two param-
eters: howMany and lineLength . The method should print out line num-
bers from 1 to howMany in the previous format, but it should not
output more than lineLength characters on any one line. It should
not start a [ unless it can fit the corresponding ] .
1.21
In the following decimal arithmetic puzzle, each of the ten different
letters is assigned a digit. Write a program that finds all possible
solutions (one of which is shown).
1.22
MARK A=1 W=2 N=3 R=4 E=5 9147
+ ALLEN L=6 K=7 I=8 M=9 S=0 + 16653
----- -----
WEISS 25800
references
Some of the C-style material in this chapter is taken from [5]. The complete
Java language specification may be found in [2]. Introductory Java topics
include [1], [3] and [4].
G. Cornell and C. S. Horstmann, Core Java 2 Volumes 1 and 2 , 8th ed.,
Prentice Hall, Upper Saddle River, NJ, 2008.
1.
J. Gosling, B. Joy, G. Steele, and G. Bracha, The Java Language Specifica-
tion , 3rd ed., Addison-Wesley, Reading, MA, 2006.
2.
J. Lewis and W. Loftus, Java Software Solutions, 6th ed., Addison-Wesley,
Boston, MA, 2008.
3.
W. Savitch, and F. M. Carrano, Java: An Introduction to Problem Solving &
Programming , 5th ed., Prentice Hall, Upper Saddle River, NJ, 2009.
4.
M. A. Weiss, Efficient C Programming: A Practical Approach , Prentice
Hall, Upper Saddle River, NJ, 1995.
5.
 
Search WWH ::




Custom Search