// Program to demonstrate ATM transaction
// in C#
using System;
class ATMDemo {
public static void Main() {
int totalBalance = 50000;
int depositAmount = 0;
int withdrawAmount = 0;
int option;
int Atmpin = 0;
Console.Write("Enter Your ATM Pin: ");
Atmpin = int.Parse(Console.ReadLine());
if (Atmpin == 1234) {
Console.WriteLine("#########Select ATM Service##########\n");
Console.WriteLine("1. Balance Enquiry\n");
Console.WriteLine("2. Cash Withdrawal\n");
Console.WriteLine("3. Deposit your Cash\n");
Console.WriteLine("4. Exit\n");
Console.WriteLine("#####################################\n\n");
Console.Write("Select option: ");
option = int.Parse(Console.ReadLine());
switch (option) {
case 1:
Console.Write("\nYour Total Account Balanace : " + totalBalance);
break;
case 2:
Console.Write("\nEnter withdrawal amount: ");
withdrawAmount = int.Parse(Console.ReadLine());
if (withdrawAmount % 100 != 0) {
Console.WriteLine("\nPlease enter withdrawal amount in multiple of 100");
} else if (withdrawAmount > totalBalance) {
Console.WriteLine("\nIn-sufficient balance in your account");
} else {
totalBalance = totalBalance - withdrawAmount;
Console.WriteLine("\n\nPlease collect your money");
Console.WriteLine("\nYour remaining balance is: " + totalBalance);
}
break;
case 3:
Console.Write("\nEnter amount to deposit: ");
depositAmount = int.Parse(Console.ReadLine());
totalBalance = totalBalance + depositAmount;
Console.WriteLine("Your current balance: " + totalBalance);
break;
case 4:
Console.WriteLine("\nInvalid Option");
break;
}
} else {
Console.WriteLine("Invalid Pin Number");
}
Console.WriteLine("\n\nTHANKS FOR USING OUT ATM SERVICE");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: