Create a console application for Bank to do transactions like Deposit, withdrawal,
class ProgramPrint Passbook.Generate tokennumbers for the customers and make a queue and allow customers to do do thetransaction in FIFO Manner and finally print the receipt.Ask User:1) Add new Customer2) Attend a customerIf user select Add new CustomerAsk for: Enter Name and Account NumberIf user select Attend Customer then1) Deposit2) Withdraw3) Print PassbookPrint: Basic details and relevant messages.
{
void Bank()
{
Queue tokenNumber = new Queue();
Queue accountNumber = new Queue();
Queue custName = new Queue();
double money;
int TokenNumber = 1;
doTransAgain:
Console.WriteLine("\n1. Adding new Customer ");
Console.WriteLine("\n2. Attend a customer ");
Console.WriteLine("----------------------------------------------------");
int outer = Convert.ToInt32(Console.ReadLine());
switch (outer)
{
case 1:
Console.WriteLine("Enter Your Name : ");
string name = Console.ReadLine();
Console.WriteLine("Enter Account Number : ");
string accno = Console.ReadLine();
tokenNumber.Enqueue(TokenNumber);
custName.Enqueue(name);
accountNumber.Enqueue(accno);
Console.WriteLine("\nPlease Wait...Your Token number is: {0} \n", TokenNumber++);
goto doTransAgain;
case 2:
if (tokenNumber.Count > 0)
{
Console.WriteLine("\n======= Select your Transaction From (1-3) ==========");
Console.WriteLine("1. Deposit Money ");
Console.WriteLine("2. Withdraw Money ");
Console.WriteLine("3. Print Passbook ");
Console.WriteLine("-------------------------------------------------------\n");
int inner = Convert.ToInt32(Console.ReadLine());
switch (inner)
{
case 1://Deposit Money
Console.WriteLine("\nYour Token No. {0} Please Attend at Counter :(A)\n", tokenNumber.Dequeue());
Console.Write("Enter the Amount to be Deposit: ");
money = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("\n------------- Cash Deposit Reciept -----------");
Console.WriteLine("\n\tCash Deposited : {0}\n\tAccount No : {1}\n\tCust Name : {2}\n", money, accountNumber.Dequeue(), custName.Dequeue());
Console.WriteLine("------------ ---------------------------------");
goto doTransAgain;
case 2://Withdrwal
Console.WriteLine("\nYour Token No. {0} Please Attend at Counter :(B)\n", tokenNumber.Dequeue());
Console.Write("Enter the Amount to be Withdraw: ");
money = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("\n------------- Cash Withdraw Reciept -----------");
Console.WriteLine("\n\tCash Withdraw : {0}\n\tAccount No : {1}\n\tCust Name : {2}\n", money, accountNumber.Dequeue(), custName.Dequeue());
Console.WriteLine("----------- ---------------------------------");
goto doTransAgain;
case 3://Print Passbook
Console.WriteLine("\nYour Token No. {0} Please Attend at Counter :(C)\n", tokenNumber.Dequeue());
Console.Write("Enter Money in Your Account : ");
money = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("\n\t\t----- Printing Pass Book ----- ");
Console.WriteLine("-------------------------------------------\n");
Console.WriteLine("\n\t\tAccount number : {0}\n\t\tAccount Holder Name :{1}\n\t\tTotal Amount : {2}\n", accountNumber.Dequeue(), custName.Dequeue(), money);
Console.WriteLine("--------------------------------------------\n");
goto doTransAgain;
}//Innser Switch case end
}//if end
else
{
Console.WriteLine("There is no Customer Available Right now...\n");
goto doTransAgain;
}
break;//outer case 2 end
}//outer switch case end
}//end of Bank Method
static void Main(string[] args)
{
Program obj = new Program();
obj.Bank();
Console.ReadLine();
}
}
No comments:
Post a Comment