This Program is for ATM transactions.

Types of transactions are:

  1. Checking Current Balance
  2. Amount Withdrawal
  3. Cash Deposit

This C# program is successfully executed. The program output is given below.

Let’s start.

Program

  1. using System;
  2. class program {
  3. public static void Main() {
  4. int amount = 2034, deposit, withdraw;
  5. int choice, pin = 0, x = 0;
  6. Console.WriteLine("Enter Your 4 Digit Pin ");
  7. pin = int.Parse(Console.ReadLine());
  8. while (true) {
  9. Console.WriteLine("WELCOME TO YES BANK ATM SERVICE\n");
  10. Console.WriteLine("1. Current Balance\n");
  11. Console.WriteLine("2. Withdraw \n");
  12. Console.WriteLine("3. Deposit \n");
  13. Console.WriteLine("4. Cancel \n");
  14. Console.WriteLine("***************\n\n");
  15. Console.WriteLine("ENTER YOUR CHOICE : ");
  16. choice = int.Parse(Console.ReadLine());
  17. switch (choice) {
  18. case 1:
  19. Console.WriteLine("\n YOUR CURRENT BALANCE IS Rs : {0} ", amount);
  20. break;
  21. case 2:
  22. Console.WriteLine("\n ENTER THE WITHDRAW AMOUNT : ");
  23. withdraw = int.Parse(Console.ReadLine());
  24. if (withdraw % 100 != 0) {
  25. Console.WriteLine("\n PLEASE ENTER THE AMOUNT IN ABOVE 100");
  26. } else if (withdraw > (amount - 1000)) {
  27. Console.WriteLine("\n SORRY! INSUFFICENT BALANCE");
  28. } else {
  29. amount = amount - withdraw;
  30. Console.WriteLine("\n\n PLEASE COLLECT YOUR CASH");
  31. Console.WriteLine("\n CURRENT BALANCE IS Rs : {0}", amount);
  32. }
  33. break;
  34. case 3:
  35. Console.WriteLine("\n ENTER THE DEPOSIT AMOUNT");
  36. deposit = int.Parse(Console.ReadLine());
  37. amount = amount + deposit;
  38. Console.WriteLine(“YOUR AMOUNT HAS BEEN DEPOSITED SUCCESSFULLY..”);
  39. Console.WriteLine("YOUR TOTAL BALANCE IS Rs : {0}", amount);
  40. break;
  41. case 4:
  42. Console.WriteLine("\n THANK YOU…”);
  43. break;
  44. }
  45. }
  46. Console.WriteLine("\n\n THANKS FOR USING YES ATM SERVICE");
  47. }
  48. }

Output

Enter Your 4 Digit Pin

1234

WELCOME TO YES BANK ATM SERVICE

  1. Current Balance
  2. Withdraw
  3. Deposit
  4. 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