Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Banka
- {
- class Program
- {
- public static List<Account> ListOfAccounts = new List<Account>();
- public static int GlobalCounter = 0;
- static void Main(string[] args)
- {
- Console.WriteLine("Welcome to our bank!");
- Console.WriteLine("1 - Make new account");
- Console.WriteLine("2 - Operations");
- Console.WriteLine("3 - Exit");
- while( true )
- {
- int unos = Convert.ToInt32(Console.ReadLine());
- if (unos == 3) break;
- else if( unos==1 )
- {
- Console.WriteLine("Name: ");
- string Name = Console.ReadLine();
- Console.WriteLine("Adress: ");
- string Adress = Console.ReadLine();
- Console.WriteLine("Phone");
- string Phone = Console.ReadLine();
- Console.WriteLine("Initial Amont: ");
- int InitialAmount = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Password: ");
- string Password = Console.ReadLine();
- Console.WriteLine("Re-type Password: ");
- string Password2 = Console.ReadLine();
- Account a = new Account(Name, Adress, Phone, InitialAmount, Password);
- ListOfAccounts.Add(a);
- }
- else if(unos==2)
- {
- Console.WriteLine("Enter your account number:");
- int RedniBroj = Convert.ToInt32(Console.ReadLine());
- while (true)
- {
- if (RedniBroj < ListOfAccounts.Count()) break;
- else
- {
- Console.WriteLine("Account number is not valid. Please type again.");
- RedniBroj = Convert.ToInt32(Console.ReadLine());
- }
- }
- Console.WriteLine("Enter your password");
- static string Password = Console.ReadLine();
- Account a = ListOfAccounts[RedniBroj - 1];
- public static bool SucessLogin = true;
- if (a.Password != Password)
- {
- Console.WriteLine("Wrong password. Please try again.");
- static string Password2 = Console.ReadLine();
- if (a.Password != Password2)
- {
- SucessLogin = false;
- Console.WriteLine("Wrong password. You have one more try:");
- static string Password3 = Console.ReadLine();
- if (a.Password != Password3)
- {
- "Your account is blocked. You must call the bank imeadiately."
- }
- else SucessLogin=true;
- }
- else
- {
- SucessLogin = true;
- }
- }
- else if (SucessLogin==true )
- {
- Console.WriteLine("Select operation to process");
- Console.WriteLine("1 - Change password");
- Console.WriteLine("2 - Deposit money");
- Console.WriteLine("3 - Withdraw money");
- Console.WriteLine("4 - Print");
- Console.WriteLine("5 - Exit menu");
- int Operation = Convert.ToInt32(Console.ReadLine());
- switch
- {
- case 1:
- while(true)
- {
- Console.WriteLine("Type your new password");
- static string NewPassword1 = Console.ReadLine();
- Console.WriteLine("Retype your new password");
- static string NewPassword2 = Console.ReadLine();
- if (NewPassword1 != NewPassword2) Console.WriteLine("They do not match.Process will start from beggining")
- else
- {
- a.Password = NewPassword1;
- break;
- }
- }
- break;
- case 2:
- Console.WriteLine("Amount: ");
- int amount = Convert.ToInt32(Console.ReadLine());
- a.Balance += amount;
- Console.WriteLine("Operation Successful");
- break;
- case 3:
- Console.WriteLine("Amount:");
- int amount = Convert.ToInt32(Console.ReadLine());
- a.Balance -= amount;
- Console.WriteLine("Operation Successful");
- break;
- case 4:
- Console.WriteLine("Name: ",a.Name);
- Console.WriteLine("Adress: ",a.Adress);
- Console.WriteLine("Balance: ", a.Balance, " KM");
- Console.WriteLine("Account number: ",RedniBroj );
- break;
- case 5:
- Console.WriteLine("Good Bye");
- public static bool Exit = true;
- break;
- if(Exit) break;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement