Develop the following Application using Visual Studio Enterprise 2019. Name the Solution Assignment1
and name the project Assignment1.
Automated Teller Machine (ATM)
In this assignment you’ll be implementing a simple ATM. You’ll be writing six classes:
1. Account – Objects of this class represent a customer’s bank account
2. ChequingAccount – It is a type of Account used for everyday banking
3. SavingAccount – it is a type of Account used for Saving purposes
4. Transaction – It is used to store the details of a Transaction.
5. AccountList – Object of this class is used to manage bank accounts
6. ATM – This class creates an object of the AccountList class and provides and provides a menu to
perform transactions, similar to an automated teller machine. This class contains the Main
method.
Account Class
The Account class keeps track of customer information like their name and bank balance, and can
perform transactions like depositing or withdrawing money from the account. Additionally, the Account
class should include the following fields and properties:
– _balance: A private field to represent the account’s balance (double)
– AccountNumber : A read-only property to represent the customer’s account number (int)
– AccountHolderName: A read-only property to represent the name of the customer (string)
– Balance: A read-only property to get the account balance (double)
– AnnualInterestRate: A property to get or set the Percent interest that the account earns
per year (double)
Unique account numbers must be generated:
– In the Account class declare a private static field named s_nextAccountNumber
– Add a static constructor and initialize it to 100
– In the regular constructor initialize the ID field to s_nextAccountNumber
– Increment the value of s_nextAccountNumber
1
Late Submissions will be penalized 10% per day, up to 3 days
Page 2 of 4
The Account class should have the following methods:
– A one-argument constructor that creates a bank account with the customer name
– A one-argument method named Deposit that deposits the specified amount to the account
(adds to the balance)
– A one-argument method named Withdraw that withdraws the specified amount from the
account (subtracts from the balance)
ChequingAccount Class
This class must extend the Account class and has an overdraft limit of $1000: A customer can withdraw
an amount of money from the account, but only if their account total after the withdrawal won’t exceed
the overdraft amount. For example, if the balance is $100 and the overdraft is $1000, the customer can
withdraw no more than $1100. The customer can also deposit an amount of money to the account.
You must declare the overdraft amount as a constant field variable in this class. You also need to
override the Withdraw method to restrict the withdrawal.
The maximum annual interest rate allowed for this account is 1%.
Hint: Use exceptions in the AnnualInterestRate Property to throw a new ArgumentOutOfRangeException
and show a proper message.
Hint: All Exceptions must be handled in the Main method of the ATM class.
SavingAccount Class
This class must extend the Account class but cannot be overdrawn. Any amount of money can be
deposited. Override the Withdraw method to implement this limitation.
The minimum annual interest rate allowed for this account is 3%.
Hint: Use exceptions in the AnnualInterestRate Property to throw a new ArgumentOutOfRangeException
and show a proper message.
Hint: All Exceptions must be handled in the Main method of the ATM class.
Transaction Class
This class should include read-only properties for the following information:
– Transaction Type (Widthraw/Deposit) (enum type)
– Amount (double)
– Date (DateTime)
Use an enumeration type to represent the Transaction Type and restrict its values to Withdraw and
Deposit.
Page 3 of 4
AccountList Class
The AccountList class represents a list of accounts and handles the operations when dealing with
multiple accounts. This class has the following private field:
– _accountList: A generic List of type Account.
Additionally AccountList contains the following methods:
– AddAccount: To add a new account to the end of the list. This methods accepts the Account to
be added to the list as a parameter.
– FindAccount: Accepts an account number as a parameter and returns the Account object if it
exists in the list, returns null otherwise.
ATM Class
This class implements a console user interface for the ATM. In the Main method of this class display the
main menu of the application with the following two options:
a. Create Account (shows the account creation option)
b. Manage Account (shows the manage account option)
NOTE: This menu should be shown to the user indefinitely, do not add an exit option to it.
The Account creation feature should allow the user to specify:
– Initial Balance
– Annual Interest Rate
– Type of account: chequing or savings. Based on the type selected by the user create
either a ChequingAccount or a SavingsAccount
After the account is created the details of the account including the AccountNumber will be displayed to
the user.
When the Manage Account option is selected, the user will be prompted to enter their account number.
If the Account number is entered incorrectly then print an error message and ask for the number again.
In another method of the ATM class, display the main menu. This method is called from main and should
be named ‘Menu’. The Menu method allows the user to perform transactions:
a. Account Info
(Shows the customer’s name, balance, and the interest earned on different lines)
b. Deposit
c. Withdraw
d. Transactions
e. Go back to the Main Menu
Page 4 of 4
You will pass an account object to the menu method (the account the user selected). You should declare
the menu method like this: public void Menu (Account acct).
Notice that this method accepts one parameter, the account object the user selected by entering an
Account number.
To display the list of transactions on an Account you must update your Account class to store the List of
Transactions. You must update the Deposit and Withdraw methods to add a Transaction to the
Transaction List.
Validation
The program must verify that all input is correct. If the user enters an incorrect input (e.g. a nonnumerical amount) an error shall be displayed and the program shall continue to work normally.
Protect the Main method against any exceptions with try-catch control structures.
Documentation
Document all classes, field variables and methods using XML Comments (the .NET equivalent for
JavaDocs)