Question: Hey,I need help with my program everything is fine with it. Is running and all information is correct, but there are few small things to
Hey,I need help with my program everything is fine with it. Is running and all information is correct, but there are few small things to fix. Some bank accounts numbers missing -. I don't know how to fix it and before the last account, I missing account number. PLEASE, IT MAY SEEM LONG BUT IS NOT. IF YOU WILL NOT HELP DO NOT JUST COPY THE SAME THING AND PASTE HERE AS ANSWER. THANK YOU FOR YOU HELP! HAVE A NICE WEEKEND!
here is my output:

Here is my Instructor output:

Here are all classes that I have:
AccountDriver
import java.text.*; // to use Decimal Format public class AccountDriver { public static void main(String[] args) { double put_in = 500; double take_out = 1000; DecimalFormat myFormat; String money; String money_in; String money_out; boolean completed; // to get 2 decimals every time myFormat = new DecimalFormat("#.00"); //to test the Checking Account class CheckingAccount myCheckingAccount = new CheckingAccount ("Benjamin Franklin", 1000); System.out.println ("Account Number " + myCheckingAccount.getAccountNumber() + " belonging to " + myCheckingAccount.getOwner()); money = myFormat.format(myCheckingAccount.getBalance()); System.out.println ("Initial balance = $" + money); myCheckingAccount.deposit (put_in); money_in = myFormat.format(put_in); money = myFormat.format(myCheckingAccount.getBalance()); System.out.println ("After deposit of $" + money_in + ", balance = $" + money); completed = myCheckingAccount.withdraw(take_out); money_out = myFormat.format(take_out); money = myFormat.format(myCheckingAccount.getBalance()); if (completed) { System.out.println ("After withdrawal of $" + money_out + ", balance = $" + money); } else { System.out.println ("Insuffient funds to withdraw $" + money_out + ", balance = $" +money); } System.out.println(); //to test the savings account class SavingsAccount yourAccount = new SavingsAccount ("William Shakespeare", 400); System.out.println ("Account Number " + yourAccount.getAccountNumber() + " belonging to " + yourAccount.getOwner()); money = myFormat.format(yourAccount.getBalance()); System.out.println ("Initial balance = $" + money); yourAccount.deposit (put_in); money_in = myFormat.format(put_in); money = myFormat.format(yourAccount.getBalance()); System.out.println ("After deposit of $" + money_in + ", balance = $" + money);= yourAccount.withdraw(take_out); money_out = myFormat.format(take_out); money = myFormat.format(yourAccount.getBalance()); if (completed) { System.out.println ("After withdrawal of $" + money_out + ", balance = $" + money); } else { System.out.println ("Insuffient funds to withdraw $" + money_out + ", balance = $" + money); } yourAccount.postInterest(); money = myFormat.format(yourAccount.getBalance()); System.out.println ("After monthly interest has been posted," + "balance = $" + money); System.out.println(); // to test the copy constructor of the savings account class SavingsAccount secondAccount = new SavingsAccount (yourAccount,5); System.out.println ("Account Number " + secondAccount.getAccountNumber()+ " belonging to " + secondAccount.getOwner()); money = myFormat.format(secondAccount.getBalance()); System.out.println ("Initial balance = $" + money); secondAccount.deposit (put_in); money_in = myFormat.format(put_in); money = myFormat.format(secondAccount.getBalance()); System.out.println ("After deposit of $" + money_in+ ", balance = $" + money); secondAccount.withdraw(take_out); money_out = myFormat.format(take_out); money = myFormat.format(secondAccount.getBalance()); if (completed) { System.out.println ("After withdrawal of $" + money_out + ", balance = $" + money); } else { System.out.println ("Insuffient funds to withdraw $" + money_out + ", balance = $" + money); } System.out.println(); //to test to make sure new accounts are numbered correctly CheckingAccount yourCheckingAccount = new CheckingAccount ("Isaac Newton ", 5000); System.out.println ("Account Number " + yourCheckingAccount.getAccountNumber() + " belonging to " + yourCheckingAccount.getOwner()); } }
====================
BankAccount
/**Defines any type of bank account*/ public abstract class BankAccount { /**class variable so that each account has a unique number*/ protected static int numberOfAccounts = 100001; /**current balance in the account*/ private double balance; /** name on the account*/ private String owner; /** number bank uses to identify account*/ private String accountNumber; /**default constructor*/ public BankAccount() { balance = 0; accountNumber = numberOfAccounts + ""; numberOfAccounts++; } /**standard constructor @param name the owner of the account @param amount the beginning balance*/ public BankAccount(String name, double amount) { owner = name; balance = amount; accountNumber = numberOfAccounts + ""; numberOfAccounts++; } /**copy constructor creates another account for the same owner @param oldAccount the account with information to copy @param the beginning balance of the new account*/ public BankAccount(BankAccount oldAccount, double amount) { owner = oldAccount.owner; balance = amount; accountNumber = oldAccount.accountNumber; } /**allows you to add money to the account @param amount the amount to deposit in the account*/ public void deposit(double amount) { balance = balance + amount; } /**allows you to remove money from the account if enough money is available,returns true if the transaction was completed, returns false if the there was not enough money. @param amount the amount to withdraw from the account @return true if there was sufficient funds to complete the transaction, false otherwise*/ public boolean withdraw(double amount) { boolean completed = true; if (amount
======================================
CheckingAccount
public class CheckingAccount extends BankAccount { private static final double FEE=0.15; public CheckingAccount() { // TODO Auto-generated constructor stub } public CheckingAccount(String name, double amount) { super(name, amount); super.setAccountNumber(getAccountNumber()+"-10"); } @Override public boolean withdraw(double amount) { amount=amount+FEE; return super.withdraw(amount); } }
====================
SavingsAccount
public class SavingsAccount extends BankAccount { private double rate=0.025; private static int savingsNumber=0; private String accountNumber=null; public SavingsAccount() { // TODO Auto-generated constructor stub } public SavingsAccount(String name, double amount) { super(name, amount); this.accountNumber=super.getAccountNumber()+this.savingsNumber++; } public SavingsAccount(BankAccount oldAccount, double amount) { super(oldAccount, amount); // TODO Auto-generated constructor stub } public SavingsAccount(int savingAccount, double initialBalance) { super(); } public void postInterest() { this.setBalance(this.getBalance()+(this.getBalance()*rate)); } public double getRate() { return rate; } public void setRate(double rate) { this.rate = rate; } public int getSavingsNumber() { return savingsNumber; } public void setSavingsNumber(int savingsNumber) { this.savingsNumber = savingsNumber; } public String getAccountNumber() { return this.accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } }
Compile Messages jGRASP Messages Run I/O Interactions --jGRASP wedge: CLASSPATH is ".:: :/Users/glodilundaya/Desktop End Clear Help --jGRASP wedge: working directory is /Users/glodilundaya/Desk -jGRASP wedge2: actual command sent [/usr/bin/java-ea Accou Account Number 100001-10 belonging to Benjamin Franklin Initial balance$1000.00 After deposit of $500.00, balance $1500.00 After withdrawal of $1000.00, balance = $499.85 Account Number 1000020 belonging to William Shakespeare Initial balance$400.00 After deposit of $500.00, balance $900.00 Insuffient funds to withdraw $1000.00, balance = $900.00 After monthly interest has been posted, balance = $922.50 Account Number null belonging to William Shakespeare Initial balance-$5.00 After deposit of $500.00, balance = $505.00 Insuffient funds to withdraw $1000.00, balance$505.00 Account Number 100003-10 belonging to Isaac Newton --jGRASP wedge: exit code for process is 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
