SenpaiZero

bank pt

Jan 14th, 2021 (edited)
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.45 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace SantosYgi_PerformanceTask
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             String username = "ygisantos";
  11.             String password = "ygi123pass";
  12.             int bankBalance = 3000;
  13.             int wallet = 10000;
  14.  
  15.             String userUsername;
  16.             String userPassword;
  17.             int userInput;
  18.             int userInputDeposit;
  19.             int userInputWithdraw;
  20.  
  21.             bool isContinue = false;
  22.  
  23.             do
  24.             {
  25.                 do
  26.                 {
  27.                     if (isContinue == false)
  28.                     {
  29.                         Console.WriteLine("What is your username?");
  30.                         userUsername = Console.ReadLine();
  31.                         Console.WriteLine("What is your password?");
  32.                         userPassword = Console.ReadLine();
  33.                         if (userUsername == username && userPassword == password)
  34.                         {
  35.                             isContinue = true;
  36.                         }
  37.                     }
  38.                 } while (isContinue == false);
  39.  
  40.                 do
  41.                 {
  42.                     Console.WriteLine("============================== \nYour Bank Balance is {0}" +
  43.                         " \nYour current money is {1}\n==============================", bankBalance, wallet);
  44.  
  45.                     Console.WriteLine("What would you like to do?");
  46.                     Console.WriteLine("1: Deposit \n2: Withdraw");
  47.                     userInput = Convert.ToInt32(Console.ReadLine());
  48.  
  49.                     if (userInput == 1)
  50.                     {
  51.                         Console.WriteLine("How much would you like to deposit?");
  52.                         userInputDeposit = Convert.ToInt32(Console.ReadLine());
  53.  
  54.                             bankBalance += userInputDeposit;
  55.                             wallet -= userInputDeposit;
  56.                     }
  57.  
  58.                     if (userInput == 2)
  59.                     {
  60.                         Console.WriteLine("How much would you like to withdraw?");
  61.                         userInputWithdraw = Convert.ToInt32(Console.ReadLine());
  62.  
  63.                             bankBalance -= userInputWithdraw;
  64.                             wallet += userInputWithdraw;
  65.                     }
  66.  
  67.                 } while (isContinue == true);
  68.             } while (true);
  69.         }
  70.     }
  71. }
  72. //ygisantos
  73.  
Add Comment
Please, Sign In to add comment