Question: Java Programming: public class AccountDriver { public static void main(String[] args) { Account myAccount = new Account(127892, 2000, 0.2); System.out.println(myAccount.toString()); //Add $100 to balance myAccount.deposit(100);
Java Programming:
![Java Programming: public class AccountDriver { public static void main(String[] args) {](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f536988c566_32766f53697f361d.jpg)
public class AccountDriver { public static void main(String[] args) { Account myAccount = new Account(127892, 2000, 0.2); System.out.println(myAccount.toString()); //Add $100 to balance myAccount.deposit(100); System.out.println(myAccount.toString()); //subtract $400 from balance myAccount.withDraw(400); System.out.println(myAccount.toString()); } public String toString() {
String ret = "Account Summary: ";
ret = "Balance:\t" + balance;
return ret;
} }
An int data field named id for the account (default 0) A double data field named balance for the account (default 0) . . A double data field named annuallnerestRate that stores the current interest rate (default 0) A Date data field named dateCreated that stores the date when the account was created. . A no-arg constructor that creates a default account Another constructor that creates an account with the specified values for id balance and annuallnerestRate The accessor and mutator methods for id, balance, and annualInterestRate. The accessor method for dateCreated. A method named getMonthlylnterestRate0 that returns the monthly interest rate . . . A method named withDraw0 that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account. What to return: Account.java . AccountDriver.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
