M
Matthew2820
Guest
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewAtm
{
class Program
{
static void Main(string[] args)
{
bool Queryq = true;
while (Queryq == true)
{
Queryq = welcomePage();
}
bool Welcome = true;
while (Welcome==true)
{
Welcome = welcomePage();
}
bool displaymenu = true;
while(displaymenu ==true)
{
displaymenu = Menu();
}
}
private static bool Menu()
{
Console.Clear();
DateTime myTime = DateTime.Now;
Console.WriteLine(myTime.ToShortTimeString());
Console.WriteLine("Main Menu");
Console.WriteLine("(1).. Withdrawal");
Console.WriteLine("(2).. Deposit");
Console.WriteLine("(3).. Check Balance");
Console.WriteLine("(4)..Exit");
int num =int.Parse(Console.ReadLine());
if (num==1)
{
Withdrawal();
return true;
}
else if (num==2)
{
Deposit();
return true;
}
else if (num==3)
{
CheckBalance();
return true;
}
else if (num==4)
{
Exit();
return false;
}
else
{
Console.WriteLine("Incorrect Keyword");
return true;
}
}
private static void Withdrawal()
{
Console.WriteLine("How much do you want to withdraw");
double num =double.Parse(Console.ReadLine());
if (num<5000)
{
Console.WriteLine("Take your cash");
}
else
{
Console.WriteLine("Insufficient fund");
}
Console.ReadLine();
Query();
}
private static void Deposit()
{
Console.WriteLine("How much do you want to deposit");
int num = int.Parse(Console.ReadLine());
string amount = string.Format("{0:C}", num);
Console.WriteLine("Your account has been successfully deposited with "+ amount);
Console.ReadLine();
Query();
}
private static void CheckBalance()
{
string myString = string.Format("Your Account Balance is {0:C}", 503000000);
Console.WriteLine( myString);
Console.ReadLine();
Query();
}
private static void Exit()
{
Console.WriteLine("Exiting.........");
}
public static bool welcomePage()
{
Console.Clear();
Console.WriteLine("Welcome To Matthew's Bank");
Console.Write("Enter you PIN: ");
int pin = int.Parse(Console.ReadLine());
if (pin == 6666)
{
Menu();
return true;
}
if(pin==1234)
{
Menu();
return true;
}
else
{
Console.WriteLine("Incorrect PIN");
Console.ReadLine();
return false;
}
}
private static bool Query()
{
Console.Clear();
Console.WriteLine("Do you want to perform another transaction");
Console.WriteLine("1..Yes");
Console.WriteLine("2..No");
int ans = int.Parse(Console.ReadLine());
if (ans == 1)
{
welcomePage();
return true;
}
else if (ans == 2)
{
return false;
}
else
{
return false;
}
}
}
}
Continue reading...
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewAtm
{
class Program
{
static void Main(string[] args)
{
bool Queryq = true;
while (Queryq == true)
{
Queryq = welcomePage();
}
bool Welcome = true;
while (Welcome==true)
{
Welcome = welcomePage();
}
bool displaymenu = true;
while(displaymenu ==true)
{
displaymenu = Menu();
}
}
private static bool Menu()
{
Console.Clear();
DateTime myTime = DateTime.Now;
Console.WriteLine(myTime.ToShortTimeString());
Console.WriteLine("Main Menu");
Console.WriteLine("(1).. Withdrawal");
Console.WriteLine("(2).. Deposit");
Console.WriteLine("(3).. Check Balance");
Console.WriteLine("(4)..Exit");
int num =int.Parse(Console.ReadLine());
if (num==1)
{
Withdrawal();
return true;
}
else if (num==2)
{
Deposit();
return true;
}
else if (num==3)
{
CheckBalance();
return true;
}
else if (num==4)
{
Exit();
return false;
}
else
{
Console.WriteLine("Incorrect Keyword");
return true;
}
}
private static void Withdrawal()
{
Console.WriteLine("How much do you want to withdraw");
double num =double.Parse(Console.ReadLine());
if (num<5000)
{
Console.WriteLine("Take your cash");
}
else
{
Console.WriteLine("Insufficient fund");
}
Console.ReadLine();
Query();
}
private static void Deposit()
{
Console.WriteLine("How much do you want to deposit");
int num = int.Parse(Console.ReadLine());
string amount = string.Format("{0:C}", num);
Console.WriteLine("Your account has been successfully deposited with "+ amount);
Console.ReadLine();
Query();
}
private static void CheckBalance()
{
string myString = string.Format("Your Account Balance is {0:C}", 503000000);
Console.WriteLine( myString);
Console.ReadLine();
Query();
}
private static void Exit()
{
Console.WriteLine("Exiting.........");
}
public static bool welcomePage()
{
Console.Clear();
Console.WriteLine("Welcome To Matthew's Bank");
Console.Write("Enter you PIN: ");
int pin = int.Parse(Console.ReadLine());
if (pin == 6666)
{
Menu();
return true;
}
if(pin==1234)
{
Menu();
return true;
}
else
{
Console.WriteLine("Incorrect PIN");
Console.ReadLine();
return false;
}
}
private static bool Query()
{
Console.Clear();
Console.WriteLine("Do you want to perform another transaction");
Console.WriteLine("1..Yes");
Console.WriteLine("2..No");
int ans = int.Parse(Console.ReadLine());
if (ans == 1)
{
welcomePage();
return true;
}
else if (ans == 2)
{
return false;
}
else
{
return false;
}
}
}
}
Continue reading...