Java Reference
In-Depth Information
r 1
r 1
( x 1, y 1)
( x 1, y 1)
r 2
r 2
( x 2, y 2)
( x 2, y 2)
(a)
(b)
F IGURE 3.12
(a) A circle is inside another circle. (b) A circle overlaps another circle.
Here are the sample runs:
0.5 5.1 13
Enter circle1's center x-, y-coordinates, and radius:
Enter circle2's center x-, y-coordinates, and radius:
circle2 is inside circle1
1 1.7 4.5
Enter circle1's center x-, y-coordinates, and radius:
Enter circle2's center x-, y-coordinates, and radius:
circle2 overlaps circle1
3.4 5.7 5.5
6.7 3.5 3
Enter circle1's center x-, y-coordinates, and radius:
Enter circle2's center x-, y-coordinates, and radius:
circle2 does not overlap circle1
3.4 5.5 1
5.5 7.2 1
*3.30
( Current time ) Revise Programming Exercise 2.8 to display the hour using a 12-
hour clock. Here is a sample run:
Enter the time zone offset to GMT:
The current time is 4:50:34 AM
-5
*3.31
( Financials: currency exchange ) Write a program that prompts the user to enter
the exchange rate from currency in U.S. dollars to Chinese RMB. Prompt the user
to enter 0 to convert from U.S. dollars to Chinese RMB and 1 to convert from
Chinese RMB and U.S. dollars. Prompt the user to enter the amount in U.S. dollars
or Chinese RMB to convert it to Chinese RMB or U.S. dollars, respectively. Here
are the sample runs:
Enter the exchange rate from dollars to RMB:
Enter 0 to convert dollars to RMB and 1 vice versa:
Enter the dollar amount:
$100.0 is 681.0 yuan
6.81
0
100
Search WWH ::




Custom Search