Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.86 KB | None | 0 0
  1. class Program
  2.     {
  3.         int saldo = 0;
  4.         static void Main(string[] args)
  5.         {
  6.             LogInMenu();
  7.            
  8.         }
  9.  
  10.         static void LogInMenu()
  11.         {
  12.             Console.WriteLine("\nVälkommen till Banken!");
  13.             Console.WriteLine("[1] Skapa nytt konto");
  14.             Console.WriteLine("[2] Avsluta");
  15.             Console.Write("\nVälj: ");
  16.  
  17.  
  18.  
  19.             int option = Convert.ToInt32(Console.ReadLine());
  20.  
  21.  
  22.             if (option == 1)
  23.             {
  24.                 UserCreateAccount();
  25.             }
  26.             else if (option == 2)
  27.             {
  28.                 Environment.Exit(0);
  29.             }
  30.  
  31.  
  32.         }
  33.         static void UserCreateAccount()
  34.         {
  35.             Console.Clear();
  36.             Console.Write("Förnamn: ");
  37.             string userfirstname = Console.ReadLine();
  38.             Console.Write("Efternamn: ");
  39.             string userlastname = Console.ReadLine();
  40.             Console.Write("Telefonnummer: ");
  41.             string userphonenumber = Console.ReadLine();
  42.             Console.Write("Kortnummer: ");
  43.             string usercardnummer = Console.ReadLine();
  44.  
  45.             MainMenu(userfirstname, userlastname);
  46.  
  47.         }
  48.  
  49.         static void MainMenu(string userfirstname, string userlastname)
  50.         {
  51.             Console.Clear();
  52.  
  53.             Console.WriteLine("\nVälkommen " + userfirstname + " " + userlastname + "!");
  54.             Console.WriteLine("[1] Sätt in pengar");
  55.             string deposit = Console.ReadLine();
  56.             Console.WriteLine("[2] Ta ut pengar");
  57.             string withdraw = Console.ReadLine();
  58.             Console.WriteLine("[3] Kontosaldo");
  59.             string balance = Console.ReadLine();
  60.             Console.WriteLine("[4] Avsluta");
  61.             Console.Write("\nVälj: ");
  62.            
  63.             int option = Convert.ToInt32(Console.ReadLine());
  64.  
  65.             if (option == 1)
  66.             {
  67.                 insättning();
  68.             }
  69.             else if (option == 2)
  70.             {
  71.                 uttagning();
  72.             }
  73.             else if (option == 3)
  74.             {
  75.                 kontosaldo();
  76.             }
  77.             else if (option == 4)
  78.             {
  79.                 Environment.Exit(0);
  80.             }
  81.         }
  82.         static void insättning()
  83.         {
  84.             int deposit;
  85.        
  86.             Console.WriteLine("Hur mycket pengar vill du sätta in: ");
  87.             deposit = balance + deposit;
  88.            
  89.  
  90.         }
  91.         static void uttagning()
  92.         {
  93.             int withdraw;
  94.             Console.WriteLine("Hur mycket pengar vill du ta ut: ");
  95.             withdraw = balance - withdraw;
  96.  
  97.         }
  98.         static void kontosaldo()
  99.         {
  100.             int balance;
  101.             Console.WriteLine("Ditt konto saldo är: " + saldo);
  102.            
  103.  
  104.  
  105.         }
  106.        
  107.  
  108.  
  109.  
  110.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement