Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this coding assignment please! The lab is to be done in JAVA. Please leave comments so that I can follow along

I need help with this coding assignment please! The lab is to be done in JAVA. Please leave comments so that I can follow along and understand what you did.

Part One: Interface Design

Write an interface called Banking.java, to include the methods deposit, withdraw and getBalance.

Part Two: Class Design

Create the following 3 classes to implement Banking:

  • CheckingAccount

  • SavingsAccount

  • RetirementAccount

All classes should have a toString() method to show the state of all pertinent data fields.

  • CheckingAccount only contains balance.

  • SavingsAccount contains balance and interest.

  • RetirementAccount contains balance, interest, and age of the account

The owner of a RetirementAccount is only allowed to withdraw from the account when it is over 25 years old.

Part Three - Testing

Run BankDriver.java

public class BankDriver { public static void main(String[] args) { Banking[] myAccounts = new Banking[4]; myAccounts[0] = new CheckingAccount(200.00); myAccounts[1] = new SavingsAccount(500.00, 0.5); myAccounts[2] = new RetirementAccount(20000, 4.3, 10); myAccounts[3] = new RetirementAccount(500000, 3.2, 35); System.out.println("INITIAL ACCOUNTS"); for(Banking account: myAccounts) { System.out.println(account); } System.out.println(); myAccounts[0].withdraw(75.75); myAccounts[1].deposit(100.00); myAccounts[2].withdraw(350.25); myAccounts[3].withdraw(250); System.out.println("TRANSACTIONS ROUND 1"); for(Banking account: myAccounts) { System.out.println(account); } System.out.println(); myAccounts[0].deposit(50.00); myAccounts[1].withdraw(500.00); myAccounts[2].deposit(30.00); myAccounts[3].deposit(100.00); System.out.println("TRANSACTIONS ROUND 2"); for(Banking account: myAccounts) { System.out.println(account); } System.out.println(); } }

Make sure your output matches this example.

INITIAL ACCOUNTS Checking Account Balance: $200.0 Savings Account Balance: $500.0, Interest Rate: 0.5% Retirement Account Balance: $20000.0, Interest Rate: 4.3%, Age of account: 10 years

Retirement Account Balance: $500000.0, Interest Rate: 3.2%, Age of account: 35 years

TRANSACTIONS ROUND 1 Checking Account Balance: $124.25 Savings Account Balance: $600.0, Interest Rate: 0.5% Retirement Account Balance: $20000.0, Interest Rate: 4.3%, Age of account: 10 years

Retirement Account Balance: $499750.0, Interest Rate: 3.2%, Age of account: 35 years

TRANSACTIONS ROUND 2 Checking Account Balance: $174.25 Savings Account Balance: $100.0, Interest Rate: 0.5% Retirement Account Balance: $20030.0, Interest Rate: 4.3%, Age of account: 10 years

Retirement Account Balance: $499850.0, Interest Rate: 3.2%, Age of account: 35 years

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

How does selection differ from recruitment ?

Answered: 1 week ago

Question

What roles have these individuals played in your life?

Answered: 1 week ago