- import java.util.Date;
- /**
- * This class will hold the account information of a retirement account
- * for a particular year.
- */
- public class AccountInformation {
- /////////////////////////////////////////////
- // Member Variables //
- /////////////////////////////////////////////
- /** The starting balance of the account for this year. */
- private double startBalance;
- /** The ending balance of the account for this year. */
- private double endBalance;
- /** The contribution made into this account during the year. */
- private double contribution;
- /** The interest earned by this account during the year. */
- private double interestEarned;
- /** The Date of the last day of the fiscal year. */
- private Date informationDateStamp;
- /////////////////////////////////////////////
- // Constructors //
- /////////////////////////////////////////////
- /** Creates an AccountInformation object. */
- public AccountInformation() {
- startBalance = 0;
- endBalance = 0;
- contribution = 0;
- interestEarned = 0;
- informationDateStamp = new Date();
- }
- /**
- * Creates an AccountInformation object.
- * @param start The year's starting balance of this retirement account.
- * @param end The year's ending balance of this retirement account.
- * @param contrib The year's contribution to this retirement account.
- * @param earned The year's earned interest of this retirement account.
- * @param dateStamp The date indicating the end of the account's fiscal year.
- */
- public AccountInformation( double start, double end, double contrib, double earned, Date dateStamp) {
- startBalance = start;
- endBalance = end;
- contribution = contrib;
- interestEarned = earned;
- informationDateStamp = dateStamp;
- }
- /////////////////////////////////////////////
- // Methods //
- /////////////////////////////////////////////
- /**
- * Returns the starting balance of this account.
- * @return The starting balance of this account.
- *
- public double getStartBalance() { return( startBalance);}
- /**
- * Sets the starting balance of this account.
- * @param start The balance to use as the starting balance.
- */
- public void setStartBalance( double start) { startBalance = start;}
- /**
- * Returns the ending balance of this account.
- * @return The year-ending balance in this account.
- */
- public double getEndBalance() { return( endBalance);}
- /**
- * Sets the ending balance of this account.
- * @param end The balance to use as the ending balance.
- */
- public void setEndBalance( double end) { endBalance = end; }
- /**
- * Returns the contribution into this account during the year.
- * @return The money deposited into this account during the year.
- */
- public double getContribution() { return( contribution);}
- /**
- * Sets the contribution level for the year.
- * @param contrib The amount contributed.
- */
- public void setContribution( double contrib) { contribution = contrib;}
- /**
- * Returns the interest earned by the account for the year.
- * @return The interest earned by this account during the year.
- */
- public double getInterestEarned() { return( interestEarned);}
- /**
- * Sets the amount of interest earned.
- * @param earned The amount of interest earned by the account.
- */
- public void setInterestEarned( double earned) { interestEarned = earned; }
- /**
- * Returns the Date object representing the last day of the fiscal year.
- * @return The date of the last day of the fiscal year.
- */
- public Date getDateStamp() { return( informationDateStamp);}
- /**
- * Sets the date of the fiscal year.
- * @param aDate The Date object for this year.
- */
- public void setDateStamp( Date aDate) { informationDateStamp = aDate;}
- // Write your version of toString() here.
- public String toString()
- {
- return("Starting balance: " + startBalance + " Ending Balance: " + endBalance + " Contribution: " + contribution + " Interest Earned: " + interestEarned + " Date: " + informationDateStamp);
- }
- }
AccountInfo
By: microhaxo | Date: Apr 13 2009 16:05 | Format: None | Expires: never | Size: 4.42 KB | Hits: 1528
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago