Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer in C# visual studios You are to write a banking application that keeps track of bank accounts. It will consist of four classes, Account,

Answer in C# visual studios

You are to write a banking application that keeps track of bank accounts. It will consist of four classes, Account, SavingsAccount, Bank and BankTest.

The Account class is used to represent a checking account in a bank. The class must have the following instance variables (or auto-implemented properties, if you prefer):

-a String called accountID

-a String called accountName

-a two-dimensional decimal array called deposits (each row represents deposits made in a week). At this point, it should not be given any initial value. Each row represents a week -and each value in the row represents a deposit amount. The number of deposits in each row will be equal, hence this would be represented by a rectangular array.

-a decimal called balance, initially set to zero.

The class should have two overloaded constructors:

-one takes parameters: accountID of type String, name of type String, and a rectangular decimal array.

-the other takes an object of account data type as parameter.

Methods:

-UpdateAcctBalance: when called, simply goes through the deposits array and adds all the deposit amounts to the balance instance variable.

-ToString: returns a String, which represents the ID, the name, the deposits, and the balance of a particular account. It also displays the deposit averages for each week, as shown below. The string returned should be as shown below:

(Must include ALL of this)

ID : 2605

Name : Jane Doe

Deposits : 200.99 95.68 77.27 99.50 |

35.25 900.25 700.99 80.36 |

100.25 450.55 200.55 879.95

Balance : $3,821.59

Avg deposit for week 1: $118.36

Avg deposit for week 2: $429.21

Avg deposit for week 3: $407.83

Highest amount deposited: $900.25

Lowest amount deposited: $35.25

(Note: the average will change depending on how many total deposits (columns) are made in each week as passed in by the Main method)

The SavingsAccount class inherits from the Account class. It has additional properties, namely minimum balance, savings rate and total interest earned. The ToString method for this class will print all the information from the base class as well as the additional held by this class. The update account balance method will calculate the sum of all deposits and calculate the interest earned by the account holder.

The Bank class is used to keep track of the accounts of the bank. This class does not have a Main method as it is not the one that runs the application. The class must have one instance variable:

-A one-dimensional array called accountsArray of type Account (the class Account is defined in the previous section). It will be able to take 10 accounts.

(Note: Feel free to create more instance variables, if there is a need.)

This class will have no constructors.

The class should have a method called AddAccount that takes a new accounts ID, name and a two-dimensional rectangular decimal array of deposits as parameters. Every time the AddAccount method is called with the appropriate values, it calls the Account constructor and assigns the newly created account to one of the elements of accountsArray. At each successful account addition, the method returns true, else it returns false.

The class should have a method called ApplyDeposits: goes through ONLY the populated elements of accountsArray and applies the deposit amounts (by calling the UpdateAcctBalance method on each element of accountsArray).

The class should have a method called ToString. This method goes through the entire accountsArray and calls the ToString method of each element (i.e., each account). If the element is not populated, this method writes No Account Found. Remember, the ToString method returns a string.

The final class, BankTest, will create an object of the Bank class and add ten accounts by calling the AddAccount method on the bank object. After adding the accounts, the test class will call the ApplyDeposits method. Finally, the test class will call the ToString method of the Bank object.

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

Step: 3

blur-text-image

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

Financial and Managerial Accounting

Authors: Belverd E. Needles, Marian Powers, Susan V. Crosson

9th edition

1439037809, 978-1439037805

More Books

Students also viewed these Accounting questions