ASSIGNMENT 9

Design an abstract class named BankAccount (java file called BankAccount.java) with the (exact) following

fields and methods (these names and caps exactly):

Filed/Method Description

Balance

NumberDeposits

NumberWithdrawals

The bank account balance

The number of deposits this month

The number of withdrawals this month

AnnualInterestRate

The annual interest rate

MonthlyServiceCharge

The monthly service charge

BankAccount A constructor method that accepts as arguments the balance and the annual

SetMonthlyServiceCharges

GetBalance

GetNumberDeposits

GetNumberWithdrawals

interest rate

A method that accepts the monthly service charges as an argument and set

the field value

A method that returns the bank account balance

A method that returns the number of deposits this month

A method that returns the number of withdrawals this month

GetAnnualInterestRate

A method that returns the annual interest rate

GetMonthlyServiceCharge

Deposit

Withdrawal

CalculateInterest

MonthlyProcess

 

A method that returns the monthly service charge 

A method that accepts the amount of the deposit as an argument, add the value of that argument to the account balance, and increment the variable holding the number of deposits. 

A method that accepts the amount of the withdrawal as an argument, subtracts that argument value from the balance, and increment the value holding the number of withdrawals. 

A method that updates the balance by calculating the monthly interest earned by the account, and adding this interest to the balance

A method that subtracts the monthly service charges from the balance, callas

The CalculateInterest method to calculate the interest, and then sets to 0 the variables for NumberDeposits, NumberWithdrawals, and

MonthlyServiceCharge

 

Next, design another class named SavingsAccount (java file called SavingsAccount.java) that extends the BankAccount class. This class should have the (exact) following fields and methods (these names and caps exactly)

Filed/Method Description

Status

A private (Boolean) field that holds the account status: if it is active or inactive. If the balance of the account falls below $25, the account becomes inactive. No withdrawals can be made from an inactive account. 

SavingsAccount A constructor method that accepts as arguments the account balance, the annual interest rate, and the monthly service charge. Based on the account balance, the constructor should set the account Status to true or false.

Deposit

Withdrawal

MonthlyProcess

A method that calls the superclass version of the Deposit method, to make a deposit and then updates the Status of the accounts if the balance goes above $25. 

A method that checks if the status of the account is active, and, if that is true, calls the superclass version of the

Withdrawal method, to make an withdrawal from the account. The method should update the

Status if the balance goes under $25.   

A method that does the monthly process based on the number of withdrawals from the account.

If the number of withdrawals for the month is less or equal to 4, the method calls the superclass version of the

MonthlyProcess method, to do the monthly process.

If the number of withdrawals for the month is more than 4, then a service charge of $1 for each withdrawal above 4 (e.g. $1 for 5, $2 for 6, etc.) is added to the superclass field that holds the monthly service charge (using the superclass

SetMonthlyServiceCharges). Then, the method calls the superclass version of the MonthlyProcess method, to do the monthly process.

Document your program (meaning follow the Assignment Code Convention, explain what each line of code does).

For 10 points extra credit, create a program/project called [YourName]-Assignment9 (replace [YourName] with your actual name) in the same project as the BankAccount.java and SavingsAccount.java .that create a SavingsAccount objects and demonstrate the methods (and different cases)

GetBalance, GetNumberDeposits,

GetNumberWithdrawals, GetAnnualInterestRate, GetMonthlyServiceCharge, Deposit, Withdrawal,

CalculateInterest, and MonthlyProcess for the particular SavingsAccount object. Take a screenshot of the editor window (showing the source code and the output) and save it as [YourName]-Screenshot (make sure you preserve the image file extension) or paste it in a document called [YourName]-Screenshot. Replace

[YourName] with your actual name. 

You can earn/loose additional points according to the following table: 

+10 For writing the driver class [YourName]-Assignment9 with requested methods

-5 For not documenting your code (should have a comment for each line of code , field, method, class, program, etc)

-5 For not using the correct program name or file name that does not have your name in it

-5 For not submitting the correct files

-30 For hardcoding the results ; i.e. printing out the expected  results instead of computing the values and then outputting the computed values

-50 For cheating

SUBMIT the BankAccount.java and SavingsAccount.java on eCampus under the Assignment 9. If you did the extra credit, also submit the [YourName]-Assignment9.java file and the [YourName]-Screenshot on eCampus

 

under the Assignment 9 (in one submission).   

    • 10 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      qq9ddor5e2.zip