Question
****Please check sample output first THANK YOU**** Design a class named Account that contains: A private int data field named id for the account (default
****Please check sample output first THANK YOU****
Design a class named Account that contains:
A private int data field named id for the account (default 0).
A private double data field named balance for the account (default 0).
A private double data field named annualInterestRate that stores the current interest rate (default 0). All accounts have the same interest rate (static variable).
A private Date data field named dateCreated that stores the date when the account was created. (import java.util.Date)
A no-argument constructor that creates a default account.
A constructor that creates an account with the specified id and initial balance.
The accessor and mutator methods for id, balance, and annualInterestRate.
A method named getMonthlyInterest() that returns the monthly interest that is accrued on the current balance.
A method named withdraw that withdraws a specified amount from the account.
A method named deposit that deposits a specified amount to the account.
A toString method which will print the current Account Id, the balance, the monthly interest and the date when the account was created. (FYI. The Date class also contains a
toString() method which will provide a String of the date created)
Write a test program that creates an array of Account objects, using a constant
MAX_ACCOUNTS to define the size of the Account array.
.Prompt the user if they would like to create an account. If so, create an Account in the array and prompt the user for the Account Id and the initial balance.
.Prompt the user for the interest rate, a withdrawal amount and a deposit amount
.Add an option to display all Accounts so you can see how changing the interest rate for one account will change the interest rate for all accounts.
Sample Output
1. Add new Account
2. Display Accounts
3. Exit
Choose: 1
Enter Account ID: 2211
Enter Account Balance: 20000
Enter Account Interest Rate: 4.5
Enter Amount to Withdrawal: 2500
Enter Amount to Deposit: 3000
Account : 2211
Balance : $20500.00
Interest Rate : 4.50
Monthly Interest: $76.88
Date Created : Sat Oct 28 11:41:10 PDT 2017
1. Add new Account
2. Display Accounts
3. Exit
Choose: 2
Account : 2211
Balance : $20500.00
Interest Rate : 4.50
Monthly Interest: $76.88
Date Created : Sat Oct 28 11:41:10 PDT 2017
1. Add new Account
2. Display Accounts
3. Exit
Choose: 1
Enter Account ID: 394922
Enter Account Balance: 10000
Enter Account Interest Rate: 12.25
Enter Amount to Withdrawal: 100
Enter Amount to Deposit: 3000
Account : 394922
Balance : $12900.00
Interest Rate : 12.25
Monthly Interest: $131.69
Date Created : Sat Oct 28 11:41:35 PDT 2017
1. Add new Account
2. Display Accounts
3. Exit
Choose: 2
Account : 2211
Balance : $20500.00
Interest Rate : 12.25
Monthly Interest: $209.27
Date Created : Sat Oct 28 11:41:10 PDT 2017
Account : 394922
Balance : $12900.00
Interest Rate : 12.25
Monthly Interest: $131.69
Date Created : Sat Oct 28 11:41:35 PDT 2017
1. Add new Account
2. Display Accounts
3. Exit
Choose: 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started