using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace program6
{
class bank
{
public int amount = 1000, dep, with;
public void balance()
{
Console.WriteLine("\n YOUR BALANCE IN Rs : "+ amount);
}
public void deposit()
{
Console.WriteLine("\n ENTER THE AMOUNT TO DEPOSIT");
dep = int.Parse(Console.ReadLine());
amount = amount + dep;
Console.WriteLine("YOUR BALANCE IS " + amount);
}
public void withdraw()
{
Console.WriteLine("\n ENTER THE AMOUNT TO WITHDRAW: ");
with = int.Parse(Console.ReadLine());
if (with % 100 != 0)
{
Console.WriteLine("\n PLEASE ENTER THE AMOUNT IN MULTIPLES OF 100");
}
else if (with > (amount - 500))
{
Console.WriteLine("\n INSUFFICENT BALANCE");
}
else
{
amount = amount - with;
Console.WriteLine("PLEASE COLLECT CASH");
Console.WriteLine("YOUR CURRENT BALANCE IS " + amount);
}
}
}
class bankmain
{
public static void Main()
{
bank b = new bank();
int choice;
while (true)
{
Console.WriteLine("1. Check Balance\n");
Console.WriteLine("2. Deposit Cash\n ");
Console.WriteLine("3. Withdraw Cash\n");
Console.WriteLine("4. Quit\n");
Console.WriteLine("***************************************\n\n");
Console.WriteLine("Enter your choice: ");
choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1:
b.balance();
break;
case 2:
b.deposit();
break;
case 3:
b.withdraw();
break;
case 4:
Console.WriteLine("\n THANK U ");
break;
}
}
}
}
}
0 Comments