- #1
whitehorsey
- 192
- 0
I'm having trouble with understanding how methods that have a parameter work.
For example,
public class Register
{
private double purchase;
private double payment;
public static final double QUARTER_VALUE = 0.25;
public static final double DIME_VALUE = 0.1;
public static final double NICKEL_VALUE = 0.05;
public static final double PENNY_VALUE = 0.01;
public Register()
{
purchase = 0;
payment = 0;
}
public void recordPurchase(double amount)
{
double newTotal = purchase + amount;
purchase = newTotal;
}
What does the value amount in the parameters equal? Is it 0?
For example,
public class Register
{
private double purchase;
private double payment;
public static final double QUARTER_VALUE = 0.25;
public static final double DIME_VALUE = 0.1;
public static final double NICKEL_VALUE = 0.05;
public static final double PENNY_VALUE = 0.01;
public Register()
{
purchase = 0;
payment = 0;
}
public void recordPurchase(double amount)
{
double newTotal = purchase + amount;
purchase = newTotal;
}
What does the value amount in the parameters equal? Is it 0?