Write a program that creates a class named BankAccount and contains: Private attributes: o id (an int), balance (a double), and annualInterestRate (a double). o count (a static int) to keep a record...


(Java in Eclipse) Included is instructions and a sample run


Write a program that creates a class named BankAccount and contains:<br>Private attributes:<br>o id (an int), balance (a double), and annualInterestRate (a double).<br>o count (a static int) to keep a record of the number of created objects.<br>Constructors:<br>o A 2-argument constructor that creates an account with given annualInterestRate<br>and balance, increments count by 1, and then stores the new count into id<br>o A no-argument constructor that invokes the 2-arg constructor and sets both balance<br>and annualInterestRate to 0.<br>Methods:<br>o Getter methods for balance, annualInterestRate, and id.<br>o Setter methods for balance and annualInterestRate.<br>o getMonthlyInterest (): returns the monthly interest (not the interest rate).<br>Monthly interest is balance * annualInterestRate / 12. Note that the<br>interest rate is a percentage, e.g. 4.5%. You need to divide it by 100.<br>o withdraw (): withdraws a specified amount from the account.<br>o deposit (): deposits a specified amount to the account.<br>o displayInfo ( ): displays the information of a bank account as shown in the sample<br>run below.<br>Write a test program that creates an object of BankAccount with a balance of $33,000, and<br>an annual interest rate of 6.7%. Use withdraw () to withdraw $1,500, use deposit () to<br>deposit $1,000, and use displayInfo () to display the account information.<br>

Extracted text: Write a program that creates a class named BankAccount and contains: Private attributes: o id (an int), balance (a double), and annualInterestRate (a double). o count (a static int) to keep a record of the number of created objects. Constructors: o A 2-argument constructor that creates an account with given annualInterestRate and balance, increments count by 1, and then stores the new count into id o A no-argument constructor that invokes the 2-arg constructor and sets both balance and annualInterestRate to 0. Methods: o Getter methods for balance, annualInterestRate, and id. o Setter methods for balance and annualInterestRate. o getMonthlyInterest (): returns the monthly interest (not the interest rate). Monthly interest is balance * annualInterestRate / 12. Note that the interest rate is a percentage, e.g. 4.5%. You need to divide it by 100. o withdraw (): withdraws a specified amount from the account. o deposit (): deposits a specified amount to the account. o displayInfo ( ): displays the information of a bank account as shown in the sample run below. Write a test program that creates an object of BankAccount with a balance of $33,000, and an annual interest rate of 6.7%. Use withdraw () to withdraw $1,500, use deposit () to deposit $1,000, and use displayInfo () to display the account information.
Sample run<br>Account ID: 1<br>Current balance: $32500.0<br>Annual interest rate: 6.700 %<br>Monthly interest rate: 0.558 %<br>Monthly interest: $181.458<br>

Extracted text: Sample run Account ID: 1 Current balance: $32500.0 Annual interest rate: 6.700 % Monthly interest rate: 0.558 % Monthly interest: $181.458
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here