public class WCashRegister
extends java.lang.Object
Constructor and Description |
---|
WCashRegister()
Creates an initial WCashRegister
|
Modifier and Type | Method and Description |
---|---|
double |
getChange()
Completes the purchase by giving change
|
void |
takePayment(java.lang.String coinName,
double coinValue,
double amount)
The overloaded takePayment method accepts an amount of money
given by coin name, value, and amount of coins.
|
void |
takePayment(WCoin coin,
double amount)
The takePayment method accepts an amount of money for payment
given some number of WCoin objects
|
public double getChange()
moneyGiven
- an int Array of money used to buy goods, in order dollars, quarters, dimes, nickels, penniespublic void takePayment(java.lang.String coinName, double coinValue, double amount)
coinName
- The name of the coin ("Euro" or "Bitcoin" for example)coinValue
- The value of the coin (in dollars)quantity
- The number of coins givenpublic void takePayment(WCoin coin, double amount)
coin
- A WCoin object with a name and valuequantity
- The number of coins given of this value. This quantity should be
a double value so that fractions of a monetary unit (0.25 Bitcoin,
for example), can be accepted