Advertisement
CGC_Codes

ATM Trans EXAMPLE

Jun 5th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.36 KB | None | 0 0
  1. using System;
  2.  
  3. class program
  4.  
  5. {
  6.  
  7.     public static void Main()
  8.  
  9.     {
  10.  
  11.  
  12.  
  13.         int amount = 1000, deposit, withdraw;
  14.  
  15.         int choice, pin = 0, x = 0;
  16.  
  17.         Console.WriteLine("Enter Your Pin Number ");
  18.  
  19.         pin = int.Parse(Console.ReadLine());
  20.  
  21.         while (true)
  22.  
  23.         {
  24.  
  25.             Console.WriteLine("********Welcome to ATM Service**************\n");
  26.  
  27.             Console.WriteLine("1. Check Balance\n");
  28.  
  29.             Console.WriteLine("2. Withdraw Cash\n");
  30.  
  31.             Console.WriteLine("3. Deposit Cash\n");
  32.  
  33.             Console.WriteLine("4. Quit\n");
  34.  
  35.             Console.WriteLine("*********************************************\n\n");
  36.  
  37.             Console.WriteLine("Enter your choice: ");
  38.  
  39.             choice = int.Parse(Console.ReadLine());
  40.  
  41.             switch (choice)
  42.  
  43.             {
  44.  
  45.                 case 1:
  46.  
  47.                     Console.WriteLine("\n YOUR BALANCE IN Rs : {0} ", amount);
  48.  
  49.                     break;
  50.  
  51.                 case 2:
  52.  
  53.                     Console.WriteLine("\n ENTER THE AMOUNT TO WITHDRAW: ");
  54.  
  55.                     withdraw = int.Parse(Console.ReadLine());
  56.  
  57.                     if (withdraw % 100 != 0)
  58.  
  59.                     {
  60.  
  61.                         Console.WriteLine("\n PLEASE ENTER THE AMOUNT IN MULTIPLES OF 100");
  62.  
  63.                     }
  64.  
  65.                     else if (withdraw > (amount - 500))
  66.  
  67.                     {
  68.  
  69.                         Console.WriteLine("\n INSUFFICENT BALANCE");
  70.  
  71.                     }
  72.  
  73.                     else
  74.  
  75.                     {
  76.  
  77.                         amount = amount - withdraw;
  78.  
  79.                         Console.WriteLine("\n\n PLEASE COLLECT CASH");
  80.  
  81.                         Console.WriteLine("\n YOUR CURRENT BALANCE IS {0}", amount);
  82.  
  83.                     }
  84.  
  85.                     break;
  86.  
  87.                 case 3:
  88.  
  89.                     Console.WriteLine("\n ENTER THE AMOUNT TO DEPOSIT");
  90.  
  91.                     deposit = int.Parse(Console.ReadLine());
  92.  
  93.                     amount = amount + deposit;
  94.  
  95.                     Console.WriteLine("YOUR BALANCE IS {0}", amount);
  96.  
  97.                     break;
  98.  
  99.                 case 4:
  100.  
  101.                     Console.WriteLine("\n THANK U USING ATM");
  102.  
  103.                     break;
  104.  
  105.             }
  106.  
  107.         }
  108.  
  109.         Console.WriteLine("\n\n THANKS FOR USING OUT ATM SERVICE");
  110.  
  111.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement