Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve the project #3. Specifying the files Project # 2 Design a class named BankAccount that contains: 1. A private int data field named accountld

Solve the project #3. Specifying the files image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Project # 2 Design a class named BankAccount that contains: 1. A private int data field named accountld for the account. 2. A private double data field named accountBalance for the account (default 0). 3. A private double data field named annuallnterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. 4. A private Date data field named dateCreated that stores the date when the account was created. 5. A no-arg constructor that creates a default account and initializes the accountld with a 4 digit random nteger 6. A one-argument constructor that creates an account with a specific initial balance (constructor argument) and initializes the accountld with a 4 digit random integer 7. The accessor and mutator methods for accountBalance and annuallnterestRate. 8. The accessor methods for dateCreated and accountld. 9. A method named getMonthlyInterestRate0 that returns the monthly interest rate. Where monthly interest rate is the annual interest rate divided by 12 10. A method named withdraw(double) that withdraws a specified amount from the account 11. A method named deposit(double) that deposits a specified amount to the account. Write a test program (class TestBankAccount) that creates a BankAccount object with a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw S2,500, use the deposit method to deposit $3,000 and then print the account id, Balance, the monthly interest, and the date when this account was created (use console output, see below). Answer Below: Project # 2 Design a class named BankAccount that contains: 1. A private int data field named accountld for the account. 2. A private double data field named accountBalance for the account (default 0). 3. A private double data field named annuallnterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. 4. A private Date data field named dateCreated that stores the date when the account was created. 5. A no-arg constructor that creates a default account and initializes the accountld with a 4 digit random nteger 6. A one-argument constructor that creates an account with a specific initial balance (constructor argument) and initializes the accountld with a 4 digit random integer 7. The accessor and mutator methods for accountBalance and annuallnterestRate. 8. The accessor methods for dateCreated and accountld. 9. A method named getMonthlyInterestRate0 that returns the monthly interest rate. Where monthly interest rate is the annual interest rate divided by 12 10. A method named withdraw(double) that withdraws a specified amount from the account 11. A method named deposit(double) that deposits a specified amount to the account. Write a test program (class TestBankAccount) that creates a BankAccount object with a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw S2,500, use the deposit method to deposit $3,000 and then print the account id, Balance, the monthly interest, and the date when this account was created (use console output, see below). Answer Below

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

Database And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

3031143426, 978-3031143427

More Books

Students also viewed these Databases questions

Question

5. Describe how contexts affect listening

Answered: 1 week ago