public class Purse
{
. . .
public double getTotal()
{
return nickels * NICKEL_VALUE
+ dimes * DIME_VALUE + quarters * QUARTER_VALUE;
}
private static final double NICKEL_VALUE = 0.05;
private static final double DIME_VALUE = 0.1;
private static final double QUARTER_VALUE = 0.25;
. . .
}
In methods of other classes, the constant is
Purse.DIME_VALUE