Java Reference
In-Depth Information
10 register.recordPurchase( 0.75 );
11 register.recordPurchase( 1.50 );
12 register.enterPayment( 2 , 0 , 5 , 0 ,
0 );
13 System.out.print( ÐChange: Ñ );
14 System.out.println(register.giveChange())
15 System.out.println( ÐExpected:
0.25Ñ );
16
17 register.recordPurchase( 2.25 );
18 register.recordPurchase( 19.25 );
19 register.enterPayment( 23 , 2 , 0 ,
0 , 0 );
20 System.out.print( ÐChange:Ñ );
21 System.out.println(register.giveChange())
22 System.out.println( ÐExpected: 2.0Ñ );
23 }
24 }
Output
Change: 0.25
Expected: 0.25
Change: 2.0
Expected: 2.0
S ELF C HECK
4. What is the difference between the following two statements?
final double CM_PER_INCH = 2.54;
and
public static final double CM_PER_INCH = 2.54;
5. What is wrong with the following statement?
double circumference = 3.14 * diameter;
144
Search WWH ::




Custom Search