Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Date;
- public class Account {
- private int id;
- private double balance;
- private static double annualInterestRate;
- private Date dateCreated;
- public Account(int myId, double myBalance) {
- id = myId;
- balance = myBalance;
- dateCreated = new Date();
- }
- public Account() {
- id = 0;
- balance = 0;
- dateCreated = new Date();
- }
- public void setId(int myId) {
- id = myId;
- }
- public int getId() {
- return id;
- }
- public void setBalance(double myBalance) {
- balance = myBalance;
- }
- public double getBalance() {
- return balance;
- }
- public static void setAnnualInterestRate(double interestRate) {
- annualInterestRate = interestRate;
- }
- public static double getAnnualInterestRate() {
- return annualInterestRate;
- }
- public Date getDateCreated() {
- return dateCreated;
- }
- public double getMonthlyInterest() {
- return (annualInterestRate / 12);
- }
- public void withdraw(double amount) {
- balance -= amount;
- }
- public void deposit(double amount) {
- balance += amount;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement