Answer to Question #241036 in C# for Gayatri

Question #241036

Task 7: Create a console application. The Main() function needs to create the objects and execute thefunctionality as per the instructions.Main( ) //Write this function{

// Task to be performed:Create a Object of ICICI Set the Account type to Saving (Use enum) Deposit Rs. 50000 to this accountCreate another Object of ICICI Set the Account type to Current (use enum)Deposit Rs. 20000 to this accountPrint the Balance of both these account objects.Now call the Transfer function to transfer the money from Savings account to Current Account.The amount to be transferred is Rs. 5000.e.g. a1.Transfer(a2,5000);Now print the Balance after the Transfer from both the accounts.

Similarly, create two accounts of HSBC Bank. Transfer Rs. 30000 from Saving to Current and display thebalance.}


1
Expert's answer
2021-09-23T02:29:01-0400


using System;
using System.Collections.Generic;
using BankAccountLibrary;
namespace App
{
    class Program
    {
        static void Main(string[] args)
        {




            //Create a Object of ICICI Set the Account type to Saving (Use enum) Deposit Rs. 50000 to this account
            ICICI ICICI1 = new ICICI(50000);
            ICICI1.AccountType = BankAccountTypeEnum.Saving;
            //Create another Object of ICICI Set the Account type to Current (use enum) Deposit Rs. 20000 to this account
            ICICI ICICI2 = new ICICI(20000);
            ICICI2.AccountType = BankAccountTypeEnum.Current;
            //Print the Balance of both these account objects.
            Console.WriteLine("The current balance of the Saving ICICI1 is: {0}", ICICI1.GetBalance());
            Console.WriteLine("The current balance of the Current ICICI2 is: {0}", ICICI2.GetBalance());
            //Now call the Transfer function to transfer the money from Savings account to Current Account.
            //The amount to be transferred is Rs. 5000. e.g. a1.Transfer(a2,5000);
            ICICI1.Transfer(ICICI2, 5000);
            //Now print the Balance after the Transfer from both the accounts.
            Console.WriteLine("The current balance of the Saving ICICI1 is: {0}", ICICI1.GetBalance());
            Console.WriteLine("The current balance of the Current ICICI2 is: {0}", ICICI2.GetBalance());
            //Similarly, create two accounts of HSBC Bank. Transfer Rs. 30000 from Saving to Current and display thebalance.




            //Create a Object of HSBC Set the Account type to Saving (Use enum) Deposit Rs. 50000 to this account
            HSBC HSBC1 = new HSBC(50000);
            HSBC1.AccountType = BankAccountTypeEnum.Saving;
            //Create another Object of HSBC Set the Account type to Current (use enum) Deposit Rs. 20000 to this account
            HSBC HSBC2 = new HSBC(20000);
            HSBC2.AccountType = BankAccountTypeEnum.Current;
            //Print the Balance of both these account objects.
            Console.WriteLine("\nThe current balance of the Saving HSBC1 is: {0}", HSBC1.GetBalance());
            Console.WriteLine("The current balance of the Current HSBC2 is: {0}", HSBC2.GetBalance());
            //Now call the Transfer function to transfer the money from Savings account to Current Account.
            //The amount to be transferred is Rs. 30000. e.g. a1.Transfer(a2,5000);
            HSBC1.Transfer(HSBC2, 30000);
            //Now print the Balance after the Transfer from both the accounts.
            Console.WriteLine("The current balance of the Saving HSBC1 is: {0}", HSBC1.GetBalance());
            Console.WriteLine("The current balance of the Current HSBC2 is: {0}", HSBC2.GetBalance());


            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS