CIS355A Week 3 lab Problem 1 Clarification - REVISED

PLEASE FOLLOW THESE REVISED INSTRUCTIONS FOR STEP 1

Account class

  • Methods:
  • processDeposit ( ) – accepts a single double parameter containing the deposit amount. Updates the balance by adding the deposit amount to the balance.
  • processWithdrawal ( ) – accepts a single double parameter containing the withdrawal amount. Updates the balance by subtracting the withdrawal amount for the balance. Note: For now do not worry about negative balances.
  • calcInterest ( ) – Coded as a double method with an empty body.
  • Sets and gets for name, account id
  • getBalance to return the balance
  • Attributes:String Account Name
  • Integer Account ID
  • Double balance
  • Constructor
  • Prompt the user and accept input for the Account Name, Account ID and the initial balance.
  • Initialize balance to zero
  • displayAccount – this method prints all account information, here is an example:

Account: 2345

Name: John Smith

Balance: $120.55

Test and make sure account class works before continuing.

The CheckingAcct class which is a derived class of the Account class.

It has no additional attributes. Overdraft withdrawls are allowed but the user is charged a $10 overdraft fee. No interest is earned.

  • Attributes:
  • Inherits all the attributes of the Account class.
  • The overDraftFee is double and is populated in the constructor of the CheckingAcct class.
  • Methods:
  • processWithdrawl() – if the withdrawl causes insufficient funds, subtract $10 and display a message “overdraft fee charged”
  • calcInterest () – If the account balance is greater than or equal to 3000.00 an interest rate of 1% or .01 is applied to increase the balance.
  • Constructor:
  • Prompt the user for the OverDraftFee.
  • displayAccount – this method prints all account information, here is an example:

Account type: Checking

Account: 2345

Name: John Smith

Balance: $120.55

The SavingsAcct class which is a derived class of the Account class.

  • Attributes:
  • Inherits all the attributes of the Account class.
  • There are no other attributes.
  • Methods:
  • calcInterest ( ) – If the account balance is greater than or equal to 5000.00 an interest rate of 4% or .04 is applied to increase the balance. If the balance is greater than or equal to 3000.00 an interest rate of 3% or .03 is applied to increase the balance. Otherwise use an interest rate of 2%. The new balance is returned to the calling program. This method should be called by getBalance so that interest is added when the balance is returned.
  • Constructor:
  • Inherited from the Account class. (no code needed)
  • displayAccount – this method prints all account information, here is an example:

Account type: Savings

Account: 2355

Name: John Smith

Interest earned: $5.02

Balance: $250.75

calcInterest should be called by getBalance so that interest is added when the balance is displayed here.

Main:

Prompt the user for the bank name and routing number. Create at least two account objects (each of a different type). Process a deposit then withdraw then calculate the interest for each account. Generate the following report:

Bank Name: XXXXXXXX Routing Number: XXXXXX

Account Name: XXXXXX Account ID: XXXXXXXXX Balance: 9999.99

Account Name: XXXXXX Account ID: XXXXXXXXX Balance: 9999.99

Create an arrayList of Account type that can handle Checking and Savings accounts (this is the bank).

Prompt for name, account number (or assign account number in main) and add at least 1 checking object and 1 savings object to the bank array.

Now use a loop to process all accounts:

  • Make an initial deposit in each account (prompt for amount).
  • Display balance
  • Make a withdrawl with sufficient funds (prompt for amount)
  • Display balance
  • Make a withdrawl with insufficient funds (prompt for amount)
  • Display the account information using displayAccount.

See example output below:

Creating a checking account, enter name: John Smith

Your checking account number is 1000

Creating a savings account, enter name: Sue Johnson

Your savings account number is 1001

Processing account: 1000

Amount to deposit: 50

Balance is 50.00

Amount to withdraw: 25

Balance is 25.00

Amount to withdraw: 30

$10 Overdraft fee charged!

Balance is -15.00

Account type: Checking

Account: 1000

Name: John Smith

Balance: $-15.00

Processing account: 1001

Amount to deposit: 500

Balance is 500.00

Amount to withdraw: 150

Balance is 350.00

Amount to withdraw: 500

Insufficient funds!

Balance is 350.00

Account type: Savings

Account: 1001

Name: Sue Johnson

Interest earned: $7.00

Balance: $357.00