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.10
(a) A circle is inside another circle. (b) A circle overlaps another circle.
Enter circle1's center x-, y-coordinates, and radius: 3.4 5.7 5.5
Enter circle2's center x-, y-coordinates, and radius: 6.7 3.5 3
circle2 overlaps circle1
Enter circle1's center x-, y-coordinates, and radius: 3.4 5.5 1
Enter circle2's center x-, y-coordinates, and radius: 5.5 7.2 1
circle2 does not overlap circle1
*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: -5
The current time is 4:50:34 AM
*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. dol-
lars 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: 6.81
Enter 0 to convert dollars to RMB and 1 vice versa: 0
Enter the dollar amount: 100
$100.0 is 681.0 yuan
Enter the exchange rate from dollars to RMB: 6.81
Enter 0 to convert dollars to RMB and 1 vice versa: 5
Enter the RMB amount: 10000
10000.0 yuan is $1468.43
 
Search WWH ::




Custom Search