package Test; import java.util.Date; public class TestAccount { public static void main (String[] args) { Account account = new Account (1122, 20000); account.setAnnualInterestRate(4.5); account.withdraw(2500); account.deposit(3000); System.out.println("Balance is " + account.getBalance()); System.out.println("Monthly interest is " + account.getMonthlyInterest()); System.out.println("This account was created at " + account.getDateCreated()); } } class Account { //define variables private int id; private double balance; private double annualInterestRate; private Date dateCreated; //a no-arg constructor that creates a default account. public Account() { id = 0; balance = 0.0; annualInterestRate = 0.0; } //constructor creates an account with the specified id and initial balance public Account(int id, double balance){ this.id = id; this.balance = balance; } public Account (int newId, double newBalance, double newAnnualInterestRate) { id = newId; balance = newBalance; annualInterestRate = newAnnualInterestRate; } //accessor and mutator methods for id, balance, and annualInterestRate public int getId(){ return id; } public double getBalance(){ return balance; } public double getAnnualInterestRate(){ return annualInterestRate; } public void setId(int id){ this.id = id; } public void setBalance(double balance){ this.balance=balance; } public void setAnnualInterestRate(double annualInteresteRate){ this.annualInterestRate = annualInterestRate; } //accessor method for dateCreated public void setDateCreated(Date newDateCreated){ dateCreated = newDateCreated; } //method named getMonthlyInterestRate()that returns the monthly interest rate. double getMonthlyInterest(){ return annualInterestRate/12; } Date getDateCreated(){ return dateCreated; } //method named withdraw that withdraws a specified amount from the account. double withdraw (double amount){ return balance -= amount; } //method named deposit that deposits a specified amount to the account double deposit (double amount){ return balance += amount; } }