Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

From Assignment 4 , the Account class was defined to model a bank account. An account has the properties account number, balance, annual interest rate,

  • From Assignment 4, the Account class was defined to model a bank account. An account has the properties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds.
  • Create one subclass as CDAccount. You will add two private variables, duration (in months) and CDannualInterestRate, and their getter and setter member functions.
  • A CDAccount doesnt allow any deposit or withdraw. However, CDAccount does inheritance deposit and withdraw methods from the Account class. So you need to override these two methods as final methods, and print out a message to the console about no withdraw or deposit allowed for a CDAccount. ( See the sample output for example.)
  • Include getMatureBalance() method to get the end balance at the mature date of the CDAccount.

    matureBalance = (balance) * (1 + CDmonthlyInterestRate)duration

  • Include toString() method to print the account ID, CD annual interest rate, the initial balance, the mature balance, and the date when this account was created. (Refer to the sample output).

** Remember the return type of the toString() method is String. To print out a formatted output from the toString() method, you can use String.format(). Also you always can concatenate two Strings with the "+" operator.

  • Include displayMonthlyInterests() method to print each monthly balance (initial balance + monthly interest) during the CD duration.

** You need to write a for-loop and apply the formula of calculating the mature balance, but replace the duration with the number of months.

  • CDAccount constructor function will call the private method, setCDAnnualInterestRate(), to set up the CD Annual Interest Rate: Every three months CD duration will increase the CDannualInterestRate by 0.5% from annualInterestRate of the base class. For example: if annualInterestRate is 3%, the CDannualInterestRate will be 3.5% of a three-months CD saving account, and the CDannualInterestRate will be 4% of a six-month CD.

** Pay attention in the UML diagram, there is no parameter in the setCDAnnualInterestRate(). You only need to call Account.getAnnualInterestRate() to get the annual interest rate as the base, then add each half percent for every three months duration.

  • Write a driver program (Assignment6.java) to test class CDAccount. Create an array contains five objects of class CDAccount with balances of $1000.00 to $5000.00, and duration from 3-month to 15-months respectively. Set the annualInterestRate to 3%. Display each account information, and print the monthly interest of every month during the saving period for each CDAccount.

  • Perform deposit and withdraw actions on each CDAccount. ( A error message will be displayed to the console to indicate the deposit and withdraw actions are not allowed.)

  • Comment your name and ID in the first line of each source file.

  • UML Diagram for the CDAccount class:

  • Sample output,

MAKE SURE THIS RUNS PERFECTLY FINE ON ECLIPSE PLZ

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago