Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Java for the following programming question: Create a class called BankAccount Each Account object should have a name, ID, accountType (Savings, Chequing and TFSA)

Use Java for the following programming question: Create a class called BankAccount

Each Account object should have a name, ID, accountType (Savings, Chequing and TFSA) and amount to be deposited for Initial opening of the account. [Hint : accountType can be a String Array].

Create 2 constant values which depict the INTEREST_SAVINGS_YEARLY=2.1% and INTEREST_TFSA_YEARLY=2.3%.

Create a default constructor with empty arguments and a constructor so that it only accepts 2 parameters, i.e., name and amount. Initialize the ID with value between 1 to 1000 using randint() method from the Random Class.

Create Set/Get methods for as required for each field.

Create 2 methods to Deposit and Withdraw money from the account respectively.

Create a Method Yearly_Interest. Depending on the account type, the interest will be different. All must be calculated from one single method.

Create a toString() method to print the values of name, ID, AccountType, amount in the account, interest earned in the year.

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_2

Step: 3

blur-text-image_3

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

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions