public class CreditCard extends Object
Modifier and Type | Field and Description |
---|---|
protected double |
balance |
Constructor and Description |
---|
CreditCard(String cust,
String bk,
String acnt,
int lim)
Constructs a new credit card instance with default balance of zero.
|
CreditCard(String cust,
String bk,
String acnt,
int lim,
double initialBal)
Constructs a new credit card instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
charge(double price)
Charges the given price to the card, assuming sufficient credit limit.
|
String |
getAccount()
Return the account identifier.
|
double |
getBalance()
Return the current balance.
|
String |
getBank()
Returns the name of the bank
|
String |
getCustomer()
Returns the name of the customer.
|
int |
getLimit()
Return the credit limit.
|
static void |
main(String[] args) |
void |
makePayment(double amount)
Processes customer payment that reduces balance.
|
static void |
printSummary(CreditCard card) |
public CreditCard(String cust, String bk, String acnt, int lim, double initialBal)
cust
- the name of the customer (e.g., "John Bowman")bk
- the name of the bank (e.g., "California Savings")acnt
- the account identifier (e.g., "5391 0375 9387 5309")lim
- the credit limit (measured in dollars)initialBal
- the initial balance (measured in dollars)public CreditCard(String cust, String bk, String acnt, int lim)
cust
- the name of the customer (e.g., "John Bowman")bk
- the name of the bank (e.g., "California Savings")acnt
- the account identifier (e.g., "5391 0375 9387 5309")lim
- the credit limit (measured in dollars)public String getCustomer()
public String getBank()
public String getAccount()
public int getLimit()
public double getBalance()
public boolean charge(double price)
price
- the amount to be chargedpublic void makePayment(double amount)
amount
- the amount of payment madepublic static void printSummary(CreditCard card)
public static void main(String[] args)