Using static variables and private methods
to improve the BankAccount class

Two problems with BankAccount class:









/**
 * BankAccount class
 *
 * @author Suzanne Balik, 14 Oct 2003
 */
public class BankAccount {

 
  
  private int balance;        //in cents
 
  private int accountNumber;
 
  private int monthlyFee;
  
  private double interest;
  
  /**
   * Create BankAccount object
   *
   * @param balance bank account balance in cents
   * @param accountNumber account number
   * @param monthlyFee  monthly fee
   * @param interest interest rate (.05 = 5%, .10 = 10%, etc.)
   */
  
  public BankAccount(int balance, int accountNumber, 
                     
		     int monthlyFee, double interest) {
  
    
    this.balance = balance;
    
    
    this.accountNumber = accountNumber;
    
    
    this.monthlyFee = monthlyFee;
    
    this.interest = interest;
  
  }
  
 
  /**
   * Returns String with account info
   * @return String with account number,
   *         balance, monthly fee, interest rate
   */ 
  public String toString() {
  
    return "Account number: " + accountNumber +
           
	
	   "\nBalance: " + balance +
	  
	 
	   "\nMonthly fee: " + monthlyFee +
	   
	 
	 
	   "\nInterest rate: " + interest;
  }
  
  /**
   * Returns string formatted as monetary amount, eg., $14.37
   * @param value number of cents
   * @return String formatted as monetary amount, eg., $14.37
   */ 
  private String formatCents(int value){
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  } 
  
 
}