This Program is for ATM transactions.
Types of transactions are:
- Checking Current Balance
- Amount Withdrawal
- Cash Deposit
This C# program is successfully executed. The program output is given below.
Let’s start.
Program
- using System;
- class program {
- public static void Main() {
- int amount = 2034, deposit, withdraw;
- int choice, pin = 0, x = 0;
- Console.WriteLine("Enter Your 4 Digit Pin ");
- pin = int.Parse(Console.ReadLine());
- while (true) {
- Console.WriteLine("WELCOME TO YES BANK ATM SERVICE\n");
- Console.WriteLine("1. Current Balance\n");
- Console.WriteLine("2. Withdraw \n");
- Console.WriteLine("3. Deposit \n");
- Console.WriteLine("4. Cancel \n");
- Console.WriteLine("***************\n\n");
- Console.WriteLine("ENTER YOUR CHOICE : ");
- choice = int.Parse(Console.ReadLine());
- switch (choice) {
- case 1:
- Console.WriteLine("\n YOUR CURRENT BALANCE IS Rs : {0} ", amount);
- break;
- case 2:
- Console.WriteLine("\n ENTER THE WITHDRAW AMOUNT : ");
- withdraw = int.Parse(Console.ReadLine());
- if (withdraw % 100 != 0) {
- Console.WriteLine("\n PLEASE ENTER THE AMOUNT IN ABOVE 100");
- } else if (withdraw > (amount - 1000)) {
- Console.WriteLine("\n SORRY! INSUFFICENT BALANCE");
- } else {
- amount = amount - withdraw;
- Console.WriteLine("\n\n PLEASE COLLECT YOUR CASH");
- Console.WriteLine("\n CURRENT BALANCE IS Rs : {0}", amount);
- }
- break;
- case 3:
- Console.WriteLine("\n ENTER THE DEPOSIT AMOUNT");
- deposit = int.Parse(Console.ReadLine());
- amount = amount + deposit;
- Console.WriteLine(“YOUR AMOUNT HAS BEEN DEPOSITED SUCCESSFULLY..”);
- Console.WriteLine("YOUR TOTAL BALANCE IS Rs : {0}", amount);
- break;
- case 4:
- Console.WriteLine("\n THANK YOU…”);
- break;
- }
- }
- Console.WriteLine("\n\n THANKS FOR USING YES ATM SERVICE");
- }
- }
Output
Enter Your 4 Digit Pin
1234
WELCOME TO YES BANK ATM SERVICE
- Current Balance
- Withdraw
- Deposit
- Cancel
ENTER YOUR CHOICE: 1
YOUR CURRENT BALANCE IS Rs: 2034
(or)
ENTER YOUR CHOICE: 2
ENTER THE WITHDRAW AMOUNT: 1500
PLEASE COLLECT YOUR CASH
CURRENT BALANCE IS Rs: 534
(or)
ENTER YOUR CHOICE : 3
ENTER THE DEPOSIT AMOUNT
1500
YOUR AMOUNT HAS BEEN DEPOSITED SUCCESSFULLY.
YOUR TOTAL BALANCE IS Rs: 3534
(or)
ENTER YOUR CHOICE: 4
THANK YOU…
THANKS FOR USING YES ATM SERVICE