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 account
Create another Object of ICICI Set the Account type to Current (use enum)
Deposit Rs. 20000 to this account
Print 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.
}
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 ICICI1 is: {0}", ICICI1.GetBalance());
Console.WriteLine("The current balance of the 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 ICICI1 is: {0}", ICICI1.GetBalance());
Console.WriteLine("The current balance of the 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("The current balance of the ICICI1 is: {0}", HSBC1.GetBalance());
Console.WriteLine("The current balance of the ICICI2 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. 5000. e.g. a1.Transfer(a2,5000);
HSBC1.Transfer(HSBC2, 5000);
//Now print the Balance after the Transfer from both the accounts.
Console.WriteLine("The current balance of the ICICI1 is: {0}", HSBC1.GetBalance());
Console.WriteLine("The current balance of the ICICI2 is: {0}", HSBC2.GetBalance());
Console.ReadLine();
}
}
}
Comments
Leave a comment