Public paste
AccountInfo
By: microhaxo | Date: Apr 13 2009 16:05 | Format: None | Expires: never | Size: 4.42 KB | Hits: 1528

  1. import java.util.Date;
  2.  
  3. /**
  4.  * This class will hold the account information of a retirement account
  5.  * for a particular year.
  6.  */
  7. public class AccountInformation {
  8.    
  9.     /////////////////////////////////////////////
  10.     //            Member Variables             //
  11.     /////////////////////////////////////////////
  12.  
  13.     /** The starting balance of the account for this year. */
  14.     private double startBalance;
  15.    
  16.     /** The ending balance of the account for this year. */
  17.     private double endBalance;
  18.    
  19.     /** The contribution made into this account during the year. */
  20.     private double contribution;
  21.    
  22.     /** The interest earned by this account during the year. */
  23.     private double interestEarned;
  24.    
  25.     /** The Date of the last day of the fiscal year. */
  26.     private Date informationDateStamp;
  27.  
  28.     /////////////////////////////////////////////
  29.     //              Constructors               //
  30.     /////////////////////////////////////////////
  31.  
  32.     /** Creates an AccountInformation object. */
  33.     public AccountInformation() {
  34.         startBalance = 0;
  35.         endBalance = 0;
  36.         contribution = 0;
  37.         interestEarned = 0;
  38.         informationDateStamp = new Date();
  39.     }
  40.  
  41.     /**
  42.      * Creates an AccountInformation object.
  43.      * @param start The year's starting balance of this retirement account.
  44.      * @param end The year's ending balance of this retirement account.
  45.      * @param contrib The year's contribution to this retirement account.
  46.      * @param earned The year's earned interest of this retirement account.
  47.      * @param dateStamp The date indicating the end of the account's fiscal year.
  48.      */
  49.     public AccountInformation( double start, double end, double contrib, double earned, Date dateStamp) {
  50.         startBalance = start;
  51.         endBalance = end;
  52.         contribution = contrib;
  53.         interestEarned = earned;
  54.         informationDateStamp = dateStamp;
  55.     }
  56.  
  57.     /////////////////////////////////////////////
  58.     //                 Methods                 //
  59.     /////////////////////////////////////////////
  60.    
  61.     /**
  62.      * Returns the starting balance of this account.
  63.      * @return The starting balance of this account.
  64.      *
  65.     public double getStartBalance() { return( startBalance);}
  66.    
  67.     /**
  68.      * Sets the starting balance of this account.
  69.      * @param start The balance to use as the starting balance.
  70.      */
  71.     public void setStartBalance( double start) { startBalance = start;}
  72.    
  73.     /**
  74.      * Returns the ending balance of this account.
  75.      * @return The year-ending balance in this account.
  76.      */
  77.     public double getEndBalance() { return( endBalance);}
  78.    
  79.     /**
  80.      * Sets the ending balance of this account.
  81.      * @param end The balance to use as the ending balance.
  82.      */
  83.     public void setEndBalance( double end) { endBalance = end; }
  84.    
  85.     /**
  86.      * Returns the contribution into this account during the year.
  87.      * @return The money deposited into this account during the year.
  88.      */
  89.     public double getContribution() { return( contribution);}
  90.    
  91.     /**
  92.      * Sets the contribution level for the year.
  93.      * @param contrib The amount contributed.
  94.      */
  95.     public void setContribution( double contrib) { contribution = contrib;}
  96.    
  97.     /**
  98.      * Returns the interest earned by the account for the year.
  99.      * @return The interest earned by this account during the year.
  100.      */
  101.     public double getInterestEarned() { return( interestEarned);}
  102.    
  103.     /**
  104.      * Sets the amount of interest earned.
  105.      * @param earned The amount of interest earned by the account.
  106.      */
  107.     public void setInterestEarned( double earned) { interestEarned = earned; }
  108.    
  109.     /**
  110.      * Returns the Date object representing the last day of the fiscal year.
  111.      * @return The date of the last day of the fiscal year.
  112.      */
  113.     public Date getDateStamp() { return( informationDateStamp);}
  114.    
  115.     /**
  116.      * Sets the date of the fiscal year.
  117.      * @param aDate The Date object for this year.
  118.      */
  119.     public void setDateStamp( Date aDate) { informationDateStamp = aDate;}
  120.    
  121.     // Write your version of toString() here.
  122.          public String toString()
  123.          {
  124.                 return("Starting balance: " + startBalance + " Ending Balance: " + endBalance + " Contribution: " + contribution + " Interest Earned: " + interestEarned + " Date: " + informationDateStamp);
  125.          }
  126.  
  127.        
  128. }