I'm working on an exercise in my Data Structures book, and it seems that I am printing the reference address instead of the actual contents? Can someone please take a look at my code and help me out? Thank you for your time.
public class CreditCard {
// instance variables
private String customer;
private String bank;
private String account;
private int limit;
protected double balance;
// constructors - account for all cases, one with a bal, and one without
public CreditCard(String cust, String bk, String acnt, int lim, double bal){
customer = cust;
bank = bk;
account = acnt;
limit = lim;
balance = bal;
}
public CreditCard(String cust, String bk, String acnt, int lim){
this(cust, bk, acnt, lim, - 0.0);
}
// accessors
public String getCustomer(){return customer;}
public String getBank(){return bank;}
public String getAccount(){return account;}
public double getLimit(){return limit;}
public double getBalance(){return balance;}
// updaters
public boolean charge(double price){
if(price + balance > limit){
return false;
}
else balance += price;
return true;
}
public void makePayment(double amount){
balance -= amount;
}
// utility (static)
public static void printSummary(CreditCard card){
System.out.println("Customer = " + card.customer);
System.out.println("Bank = " + card.bank);
System.out.println("Account = " + card.account);
System.out.println("Limit = " + card.limit);
System.out.println("Balance = " + card.balance);
}
}// end class CreditCard