Java Bank Account Application

Bank Account Application

You are an IT Support Administrator Specialist at BOA and are

charged with the task of creating new bank accounts for new bank

customers. Saving Account and Checking Account. Please complete

the following instructions:

 

Base class: public abstract class Account

List common properties for Saving and Checking accounts

    private String name

    private String sSN

    private double balance

    private static int index = 10000

    //index will be incremented every time we create a new account

    protected String accountNumber

    protected double rate

    constant number: BASE RATE = 2.5

Constructor to set base properties and initialize the account: name, sSN, balance, accountNumber, rate

    public Account(String name, String sSN, double initDeposit)

You also need to update index, set account number, set Rate inside the Account constructor

    Abstract method: public abstract void setRate();

List common methods for Saving and Checking accounts

    Set account number: private String setAccountNumber()

    generate a 12-digit account number: 4 digit of SSN + 5digit uniqueID + 3 digit random number

    4 digit of SSN: the last four digit of SSN (sSN.substring(sSN.length()-4,sSN.length()))

    5 digit uniqueID: index (//index will be incremented every time we create a new account)

    3 digit random number: ranInt.nextInt(900)+ 100

print out all account information: name, sSN, accountNumber, balance, rate: public void showInfo()

    deposit money to the account: public void deposit(double amount) (please call printBalance() at the end)

    withdraw money from the account: public void withdraw(double amount) (please call printBalance() at the end)

    calculate and print out the accrued interest by using the rate/100*balance,and update the new balance: public void compound() (please call printBalance() at the end)

print out the new balance: public void printBalance()

 

Derived class: public class CheckingAccount extends Account

    Constructor to initialize settings for the Checking account properties.

    public CheckingAccount(String name, String sSN, double initDeposit) please call super() inside, and add 1 to the front of your 12-digit accountNumber, 1 indicates Checking account.

Now your accountNumber should be a 13-digit number.

List any methods specific to the Checking Account

override showInfo() method: public void showInfo() (please use super to call the base showInfo(), and also print out account type: Checking in the new showInfo())

    set rate = BASE RATE*0.15: public void setRate()

 

Derived class: public class SavingAccount extends Account

    Constructor to initialize settings for the Saving account properties

    public SavingAccount(String name, String sSN, double initDeposit) please call super() inside, and add 2 to the front of your 12-digit accountNumber, 2 indicates Saving account.

Now your accountNumber should be a 13-digit number.

List any methods specific to the Saving Account

override showInfo() method: public void showInfo() (please use super to call the base showInfo(), and also print out account type: Saving in the new showInfo())

    set rate = BASE RATE*0.25: public void setRate()

 

Driver class: public class AccountApp

Sample Driver class:

 

public class AccountApp {

    public static void main(String[] args) {

        // TODO Auto-generated method stub

        CheckingAccount myAccount = new

        CheckingAccount("Xin Yang","6857345856",1000);

        myAccount.ShowInfo();

        myAccount.deposit(2000);

        myAccount.withDraw(4000);

        myAccount.withDraw(1500);

        myAccount.compound();

        System.out.println("****************************************");

        SavingAccount myAccount2 = new

        SavingAccount("Ada Zhang","684321924",5000);

        myAccount2.ShowInfo();

        myAccount2.deposit(200);

        myAccount2.withDraw(45000);

        myAccount2.withDraw(550);

        myAccount2.compound();

    }

}

 

Sample Output:

Name: Xin Yang

sSN: 6857345856

Account Number: 1585610001183

Balance: 1000.0

Rate: 0.375%

Account Type: Checking Account

 

==============================

Deposit $2000.0

Your balance is now: $3000.0

================================

WithDraw $4000.0

Not enough balance available

Your balance is now: $3000.0

================================

WithDraw $1500.0

Your balance is now: $1500.0

================================

Accrued Interest is: $5.625

Your balance is now: $1505.625

================================

****************************************

Name: Ada Zhang

sSN: 684321924

Account Number: 2192410002737

Balance: 5000.0

Rate: 0.625%

Account Type: Saving Account

============================

Deposit $200.0

Your balance is now: $5200.0

================================

WithDraw $45000.0

Not enough balance available

Your balance is now: $5200.0

================================

WithDraw $550.0

Your balance is now: $4650.0

 

================================

Accrued Interest is: $29.0625

Your balance is now: $4679.0625

Need a custom answer at your budget?

This assignment has been answered 5 times in private sessions.

Or buy a ready solution below.

Buy ready solution

Solution previews

© 2024 Codify Tutor. All rights reserved