Advertisement
Guest User

peytonlanguage

a guest
Mar 6th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. import java.util.Date;
  2.  
  3. public class Account {
  4.  
  5.     private int id;
  6.     private double balance;
  7.     private static double annualInterestRate;
  8.     private Date dateCreated;
  9.    
  10.     public Account(int myId, double myBalance) {
  11.         id = myId;
  12.         balance = myBalance;
  13.         dateCreated = new Date();
  14.     }
  15.    
  16.     public Account() {
  17.         id = 0;
  18.         balance = 0;
  19.         dateCreated = new Date();
  20.     }
  21.    
  22.     public void setId(int myId) {
  23.         id = myId;
  24.     }
  25.    
  26.     public int getId() {
  27.         return id;
  28.     }
  29.    
  30.     public void setBalance(double myBalance) {
  31.         balance = myBalance;
  32.     }
  33.    
  34.     public double getBalance() {
  35.         return balance;
  36.     }
  37.    
  38.     public static void setAnnualInterestRate(double interestRate) {
  39.         annualInterestRate = interestRate;
  40.     }
  41.    
  42.     public static double getAnnualInterestRate() {
  43.         return annualInterestRate;
  44.     }
  45.    
  46.     public Date getDateCreated() {
  47.         return dateCreated;
  48.     }
  49.    
  50.     public double getMonthlyInterest() {
  51.         return (annualInterestRate / 12);
  52.     }
  53.    
  54.     public void withdraw(double amount) {
  55.         balance -= amount;
  56.     }
  57.    
  58.     public void deposit(double amount) {
  59.         balance += amount;
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement