Question: Using C#, we need to implement I C o m p a r a b l e interface and the C o m p a

Using C#, we need to implement "I C o m p a r a b l e" interface and the "C o m p a r e T o" method that will sort accounts for clients based on their type_of_account (chequing, saving, other) and their balance (any numbers).

We first need to check and sort based on type_of_account and if the types are the same we sort based on balance.

Overloading the + operator that will take 2 accounts as parameters and the return type should be a new account that merges both accounts and its type_of_account comes from the first parameter and the balance will be the sum of the 2 accounts' balance.

We need to test the "C o m p a r e T o" method by having an array of 2 Account objects, initialize each of the objects to different values and display the array before calling Array.Sort and then display the newly sorted array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!