latest Post

C# Program to Display the ATM Transaction

This C# Program Displays the ATM Transaction.
Here The types of ATM transaction are
1) Balance checking
2) Cash withdrawal
3) Cash deposition.
You can opt any of the above transaction according to your need of transaction
using System;
class program
{
public static void Main() {
int amt = 7000, deposit, withdraw; int choice, pin = 0, x = 0;
Console.WriteLine("Enter Your Pin Number ");
pin = int.Parse(Console.ReadLine());
while (true) {
Console.WriteLine("-----------Welcome to ATM Service-------------\n");
Console.WriteLine("1. Check Balance\n");
Console.WriteLine("2. Withdraw Cash\n"); Console.WriteLine("3. Deposit 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: Console.WriteLine("\n YOUR BALANCE IN Rs : {0} ", amt);
break;
case 2: Console.WriteLine("\n ENTER THE Amount TO WITHDRAW: ");
withdraw = int.Parse(Console.ReadLine());
if (withdraw % 100 != 0)
{
 Console.WriteLine("\n PLEASE ENTER THE Amount IN MULTIPLES OF 100");
}
else if (withdraw > (amt - 500)) {
Console.WriteLine("\n INSUFFICENT BALANCE"); }
 else {
amt = amt - withdraw;
Console.WriteLine("\n\n PLEASE COLLECT CASH");
Console.WriteLine("\n YOUR CURRENT BALANCE IS {0}", amt);
}
 break;
 case 3: Console.WriteLine("\n ENTER THE Amount TO DEPOSIT");
deposit = int.Parse(Console.ReadLine());
amt = amt + deposit;
Console.WriteLine("YOUR BALANCE IS {0}", amt);
break;
case 4: Console.WriteLine("\n THANK U USING ATM");
break;
}
}
 Console.WriteLine("\n\n THANKS FOR USING OUT ATM SERVICE");
}
}
 Here is the output of the C# Program:
 Enter Your Pin Number 527
 -----------Welcome to ATM Service-------------
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
 ............................................... Enter your choice: 1
 YOUR BALANCE IN Rs : 7000

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment