bank449494
public
Jul 31, 2024
Never
148
1 using System; 2 using System.Data; 3 using System.Diagnostics.Eventing.Reader; 4 using System.Runtime.CompilerServices; 5 using System.Security.Cryptography.X509Certificates; 6 using System.Threading; 7 8 internal class Program 9 { 10 private static int balance = 1000; 11 private static int pinNumber = 6749; // namespace.variable 12 13 14 private static void Main(string[] args) 15 { 16 17 18 Console.WriteLine("[DEBUG] Your Pin: " + Program.pinNumber); 19 20 Console.WriteLine("Please Enter Pin: "); 21 string userInput = Console.ReadLine(); 22 23 if (int.TryParse(userInput, out int pinNumberInput)) 24 { 25 if (pinNumber == pinNumberInput) 26 { 27 Console.WriteLine("Correct!"); 28 AccessGranted(); 29 30 } 31 else 32 { 33 Console.WriteLine("ERROR | Try Again!"); 34 } 35 } 36 else 37 { 38 Console.WriteLine("Invalid input. Please enter a numeric pin."); 39 } 40 41 42 Console.ReadLine(); 43 } 44 45 private static void AccessGranted() 46 { 47 Console.Clear(); 48 Console.WriteLine("Access Granted! Welcome!"); 49 Console.WriteLine("Current Balence: " + Program.balance); 50 51 string Mode1 = "Withdrawl"; 52 string Mode2 = "Deposit"; 53 54 Console.WriteLine("Do you want to Withdrawl or Deposit?: "); 55 string InputBankMode = Console.ReadLine(); 56 57 if (InputBankMode == Mode1) 58 { 59 Console.WriteLine("You have chosen to withdrawl"); 60 Thread.Sleep(5000); 61 UserCheckBalence(); 62 } 63 else if (InputBankMode == Mode2) 64 { 65 Console.WriteLine("You have chosen to Deposit"); 66 Thread.Sleep(5000); 67 AccessGranted(); 68 } 69 else 70 { 71 Console.WriteLine("ERROR | Try Again!"); 72 Thread.Sleep(5000); 73 Console.Clear(); 74 AccessGranted(); 75 76 } 77 } 78 79 private static void UserCheckBalence() // check if able to withdrawl 80 { 81 Console.WriteLine("Current Balance: " + Program.balance); 82 83 if (Program.balance < 0) 84 { 85 Console.WriteLine("You are too poor , earn more cash!"); 86 } 87 else 88 { 89 Withdrawl(); 90 } 91 92 } 93 private static void Withdrawl() 94 { 95 Console.WriteLine("How much money would you like to withdrawl?"); 96 string input = Console.ReadLine(); 97 if (!int.TryParse(input, out int withDrawl)) 98 return; 99 } 100 } 101