Menu

[Solved] Objective 19 Testing Application Code Going Develop Class Test Application Verify Correct Q37156909

Objective 19: Testing ApplicationCode

You are going to develop a class and a Test Application toverify the correct operation.

(The Account class) Design a class named Account thatcontains:

– A private int data field named id for the account (default0).

– A private double data field named balance for the account(default 0).

– A private double data field named annualInterestRate thatstores the current interest rate

(default 0). All accounts have the same interest rate (staticvariable).

– A private Date data field named dateCreated that stores thedate 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 idand initial balance.

– The accessor and mutator methods for id, balance, andannualInterestRate.

– A method named getMonthlyInterest() that returns the monthlyinterest that is accrued on

the current balance.

– A method named withdraw that withdraws a specified amount fromthe account.

– A method named deposit that deposits a specified amount to theaccount.

– A toString method which will print the current Account Id, thebalance, the monthly

interest and the date when the account was created. (FYI. TheDate class also contains a

toString() method which will provide a String of the datecreated)

Main Objectives

– Implement the class above.

– 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. Ifso, create an Account in the

array and prompt the user for the Account Id and the initialbalance.

– Prompt the user for the interest rate, a withdrawal amount anda deposit amount

– Add an option to display all Accounts so you can see howchanging the interest rate for

one account will change the interest rate for all accounts.

Sample output

1. Add new Account 2. Display Accoun 3. Exit Choose: 1 Enter account ID: 2211 Enter Account Balance: 20000 Enter Account Inte2. Display Accounts 3. Exit : 2211 Account : $20500.00 Balance Interest Rate : 4.50 Monthly Interest $76.88 Date Created : Sa

1. Add new Account 2. Display Accoun 3. Exit Choose: 1 Enter account ID: 2211 Enter Account Balance: 20000 Enter Account Interest Rate: 4.5 Enter Amount to Withdraal: 2500 Enter Amount to Deposit: 3000 Account : 2211 :$20500.00 -교-교n_e Interes Monthly Interest: -76.88 Date Created: Sat Oct 28 11: 41:10 PDT 2017 Rae :4.50 2. Display Accounts 3. Exit : 2211 Account : $20500.00 Balance 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 Acc unt Interest Rate: 12.25 Enter Amount to Withdrawal: 100 Enter Amount to Deposit: 3000 Account : 394922 : $12900.00 Balance 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 : $20500.00 Balance Interest Rate : 12.25 Monthly Interest $209.27 Date Created : Sat Oct 28 11:41:10 PDT 2017 : 394922 : $12900.00 Account Balance 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 Show transcribed image text 1. Add new Account 2. Display Accoun 3. Exit Choose: 1 Enter account ID: 2211 Enter Account Balance: 20000 Enter Account Interest Rate: 4.5 Enter Amount to Withdraal: 2500 Enter Amount to Deposit: 3000 Account : 2211 :$20500.00 -교-교n_e Interes Monthly Interest: -76.88 Date Created: Sat Oct 28 11: 41:10 PDT 2017 Rae :4.50
2. Display Accounts 3. Exit : 2211 Account : $20500.00 Balance 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 Acc unt Interest Rate: 12.25 Enter Amount to Withdrawal: 100 Enter Amount to Deposit: 3000 Account : 394922 : $12900.00 Balance 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 : $20500.00 Balance Interest Rate : 12.25 Monthly Interest $209.27 Date Created : Sat Oct 28 11:41:10 PDT 2017 : 394922 : $12900.00 Account Balance 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

Expert Answer


Answer to Objective 19: Testing Application Code You are going to develop a class and a Test Application to verify the correct ope… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *