Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an application that creates one Bank with three different bank account typ

ID: 3865064 • Letter: W

Question

Write an application that creates one Bank with three different bank account types: SavingsAccount, CheckingAccount, and IRAAccount. The Bank class implements the Transaction interface. The accounts extend the abstract Account class.

Part 1: Relationship Diagram

Sketch the relationship diagram. Identify any has-a, is-a, and can-do relationships. Include the name of the class or interface, any class variables and methods.

Part 2: Java files

Implement the classes based on the documentation files. These are provided with the assignment in a compressed file (.zip) called Lab5Doc.zip.

To test your code, run BankDriver application. MODIFY IT TO READ FROM A FILE!

Driver output:

Program 5, Patty Kraft, masc0777

Creating accounts...
Customer: Waterford Ellingsworth, Savings account 1 Balance: $4350.00
Customer: Bethanie Treadwell, Checking account 2 Balance: $500.00
Customer: Ira Standish, IRA Savings account 3 Balance: $50000.00, Disbursement Age=59, Early Withdrawal Penalty=0.1

Performing transactions...
Savings account 1 Balance: $4550.00
Checking account 2 Balance: $286.87
IRA Savings account 3 Balance: $50000.00, Disbursement Age=59, Early Withdrawal Penalty=0.1

Updating accounts...
Savings account 1 Balance: $4559.10
Checking account 2 Balance: $286.52
IRA Savings account 3 Balance: $55000.00, Disbursement Age=59, Early Withdrawal Penalty=0.1

Extra Credit

Create a DebitCard account that extends CheckingAccount. Add public methods debit() and credit(); set transaction fee to 0.35. Be efficient! Reuse code.

Input help

Read the input from a comma separated file. Let 1=SavingsAccount type, 2=CheckingAccount type, 3=IRAAccount type, and (if implemented) 4=DebitCard type.

Use a Scanner object containing a line from the file and call useDelimiter():

Customer: Debi Cardashian, Debit Card Checking account 4 Balance: $5100.00 Debit Card Checking account 4 Balance: $5100.00

Scanner infile = new Scanner(customers); // where customers is a File object Scanner s2 = new Scanner(infile.nextLine());
s2.useDelimiter(",");
if (s2.hasNextInt()) accountType = s2.nextInt(); // etc. reading other fields

Explanation / Answer

import java.util.Scanner;
public class SavingsAccountTest
{
public static void main(String[] args)
{
double startBalance;
double annualInterestRate;
int months;
double depositAmount;
double withdrawAmount;
Scanner input = new Scanner(System.in);
System.out.print("Enter starting balance: $");
startBalance = input.nextDouble();
System.out.print("Enter annual interest rate: ");
annualInterestRate = input.nextDouble();
System.out.print("Enter the number of months: ");
months = input.nextInt();

SavingsAccount sa = new SavingsAccount(startBalance, annualInterestRate);

for (int i = 1; i <= months; i++)
{
System.out.print("Enter amount to deposit for the month " + i + ":$");
depositAmount = input.nextDouble();

sa.setDeposit(depositAmount);
System.out.print("Enter amount to withdraw for the month " + i + ":$");
withdrawAmount = input.nextDouble();

sa.setWithdraw(withdrawAmount);

sa.accrueMonthlyInterest();

}

displayData(sa);
}
public static void displayData(SavingsAccount sa)
{
double balance = Math.round(sa.getBalance() * 100.0) / 100.0;
double totalInterest = Math.round(sa.getTotalInterest() * 100.0) / 100.0;
System.out.println();
System.out.println("The ending balance is: $" + balance);
System.out.println("Total amount of deposits: $" + sa.getTotalDeposits());
System.out.println("Total amount of withdraws: $" + sa.getTotalWithdraws());
System.out.println("Total interest earned: $" + totalInterest);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote