C# .Net assignment
CS 5110 HW2 (70 Points) Due Date: 6/1/2021, 11:59 pm
Abstract Classes, Interfaces, Polymorphism. Loops, If/Switch statements
(Polymorphic Banking Program Using Account Hierarchy) Develop a polymorphic banking app using the Account/Checking/Savings hierarchy created in HW2.
1. Modify class Account by declaring it abstract, make the constructors protected instead of public, and have the class implement Icomparable. The CompareTo method will compare Balance.
In your main
2. Set up your data: Create a List of Account objects that includes Savings and Checking objects. Place at least 5 instances in your List.
3. Sort the List by Balance by using the built in Sort method for List. If you didn’t have Account implement Icomparable, this will not work. Print out the contents of List.
4. Extend this solution further to simulate an ATM machine. (We need a little practice with loops.)
The system prompts the user to enter an id. If the id is entered incorrectly, ask the user to enter a correct id. Once an id is accepted, the main menu is displayed as shown in the sample run.
You can enter a choice 1 for viewing the current balance, 2 for withdrawing money, 3 for depositing money, and 4 for exiting the main menu.
Once you exit, the system will prompt for an id again. Thus, once the system starts, it will not stop. You will need to cntrl-c to stop your program; this is ok for this assignment. If you want your program to terminate more elegantly you can add in additional logic, but this is not required. Your program should run something like displayed below. You do not need to worry about setting an interest rate.
Sample run>>
Enter an id: 1
Main menu
1: Check balance
2: Withdraw
3: Deposit
4: Exit
Enter a choice: 1
The balance is 100.0
Main menu
1: Check balance
2: Withdraw
3: Deposit
4: Exit
Enter a choice: 2
Enter an amount to withdraw: 50
Main menu
1: Check balance
2: Withdraw
3: Deposit
4: Exit
Enter a choice: 4
Enter an id: 3
Main menu
1: Check balance
2: Withdraw
3: Deposit
4: Exit
Enter a choice: