public abstract class PhoneCard extends Object
Constructor and Description |
---|
PhoneCard(long number,
int password,
double balance)
Create a phone card with the given number, password, and balance.
|
Modifier and Type | Method and Description |
---|---|
abstract Set<CallZone> |
allowedZones()
Get the set of call zones that can be called on this phone card.
|
boolean |
charge(int minutes,
CallZone zone)
Charge a call of the given number of minutes to the zone.
|
abstract double |
costPerMin(CallZone zone)
Get the cost per minute of a call to the argument zone on this phone card.
|
abstract void |
deductWeeklyFee()
Deduct the appropriate weekly fees from the card's balance.
|
boolean |
equals(Object obj)
Indicate whether some other object is "equal to" this one.
|
double |
getBalance()
Get the balance of this phone card.
|
int |
getLimit(CallZone zone)
Get the number of minutes allowed for a call to zone given the balance.
|
long |
getNumber()
Get the number of this phone card.
|
int |
getPassword()
Get the password of this phone card.
|
abstract boolean |
isAllowed(CallZone zone)
Check whether a call to the argument zone is allowed for this phone card.
|
void |
setBalance(double balance)
Set the balance of this phone card.
|
String |
toString()
Create a string representation of the object.
|
public PhoneCard(long number, int password, double balance)
number
- the phone card's number.password
- the card's password.balance
- the card's balance.public long getNumber()
public int getPassword()
public double getBalance()
public void setBalance(double balance)
balance
- the balance to set.public abstract boolean isAllowed(CallZone zone)
zone
- the zone to check.public abstract Set<CallZone> allowedZones()
public abstract double costPerMin(CallZone zone)
public int getLimit(CallZone zone)
zone
- the zone that the call is going to.public boolean charge(int minutes, CallZone zone)
minutes
- the number of minutes to charge.zone
- the zone that the call is going to.public abstract void deductWeeklyFee()
public boolean equals(Object obj)