Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.Win32;
- namespace ConsoleApp1
- {
- class Program
- {
- static void welcome()
- {
- Console.WriteLine("+----------------------------------------------------------------------------------------------------+");
- Console.WriteLine("| _____ _____ _______ _____ |");
- Console.WriteLine("| /\\ \\ /\\ \\ /::\\ \\ /\\ \\ |");
- Console.WriteLine("| /::\\ \\ /::\\ \\ /::::\\ \\ /::\\ \\ |");
- Console.WriteLine("| /::::\\ \\ /::::\\ \\ /::::::\\ \\ /::::\\ \\ |");
- Console.WriteLine("| /::::::\\ \\ /::::::\\ \\ /::::::::\\ \\ /::::::\\ \\ |");
- Console.WriteLine("| /:::/\\:::\\ \\ /:::/\\:::\\ \\ /:::/~~\\:::\\ \\ /:::/\\:::\\ \\ |");
- Console.WriteLine("| /:::/ \\:::\\ \\ /:::/__\\:::\\ \\ /:::/ \\:::\\ \\ /:::/__\\:::\\ \\ |");
- Console.WriteLine("| /:::/ \\:::\\ \\ /::::\\ \\:::\\ \\ /:::/ / \\:::\\ \\ \\:::\\ \\:::\\ \\ |");
- Console.WriteLine("| /:::/ / \\:::\\ \\ /::::::\\ \\:::\\ \\ /:::/____/ \\:::\\____\\ ___\\:::\\ \\:::\\ \\ |");
- Console.WriteLine("| /:::/ / \\:::\\ ___\\ /:::/\\:::\\ \\:::\\ ___\\ |:::| | |:::| | /\\ \\:::\\ \\:::\\ \\ |");
- Console.WriteLine("|/:::/____/ \\:::| |/:::/__\\:::\\ \\:::| ||:::|____| |:::| |/::\\ \\:::\\ \\:::\\____\\|");
- Console.WriteLine("|\\:::\\ \\ /:::|____|\\:::\\ \\:::\\ /:::|____| \\:::\\ \\ /:::/ / \\:::\\ \\:::\\ \\::/ /|");
- Console.WriteLine("| \\:::\\ \\ /:::/ / \\:::\\ \\:::\\/:::/ / \\:::\\ \\ /:::/ / \\:::\\ \\:::\\ \\/____/ |");
- Console.WriteLine("| \\:::\\ \\ /:::/ / \\:::\\ \\::::::/ / \\:::\\ /:::/ / \\:::\\ \\:::\\ \\ |");
- Console.WriteLine("| \\:::\\ /:::/ / \\:::\\ \\::::/ / \\:::\\__/:::/ / \\:::\\ \\:::\\____\\ |");
- Console.WriteLine("| \\:::\\ /:::/ / \\:::\\ /:::/ / \\::::::::/ / \\:::\\ /:::/ / |");
- Console.WriteLine("| \\:::\\/:::/ / \\:::\\/:::/ / \\::::::/ / \\:::\\/:::/ / |");
- Console.WriteLine("| \\::::::/ / \\::::::/ / \\::::/ / \\::::::/ / |");
- Console.WriteLine("| \\::::/ / \\::::/ / \\::/____/ \\::::/ / |");
- Console.WriteLine("| \\::/____/ \\::/____/ ~~ \\::/ / |");
- Console.WriteLine("| ~~ ~~ \\/____/ |");
- }
- static string inputUserName()
- {
- string userName;
- Console.WriteLine("+----------------------------------------------------------------------------------------------------+");
- Console.Write("|>USERNAME-> ");
- userName = Console.ReadLine();
- return userName;
- }
- static string inputPass()
- {
- string pass;
- Console.Write("|>PASSWORD-> ");
- pass = string.Empty;
- ConsoleKeyInfo key;
- do
- {
- key = Console.ReadKey(true);
- if (key.Key == ConsoleKey.Enter) break;
- if (key.Key == ConsoleKey.Backspace)
- {
- if (pass.Length != 0)
- {
- pass = pass.Remove(pass.Length - 1);
- Console.Write("\b \b");
- }
- }
- else
- {
- pass += key.KeyChar;
- Console.Write("*");
- }
- } while (true);
- return pass;
- }
- static void messWelcome(string user = " ")
- {
- Console.WriteLine("\n*******************************\n");
- Console.WriteLine($"\t WELCOME {user.ToUpper()} \n");
- Console.WriteLine("*******************************");
- }
- static int[] enterIncome(string[] month, int[] incomes)
- {
- int input;
- for (int i = 0; i < incomes.Length; i++)
- {
- while (true)
- {
- Console.Write($"|>INCOME FOR {month[i].ToUpper()} -> ");
- try
- {
- input = int.Parse(Console.ReadLine());
- incomes[i] = input;
- break;
- }
- catch (FormatException)
- {
- Console.WriteLine("\n \t ERROR \n");
- }
- }
- }
- return incomes;
- }
- static void sort(string[] month, int[] income)
- {
- int tmp;
- string temp;
- int summ = 0;
- for (int i = 0; i < income.Length; i++)
- {
- summ += income[i];
- for (int j = 1; j < income.Length; j++)
- {
- if (income[i] > income[j])
- {
- tmp = income[i];
- temp = month[i];
- income[i] = income[j];
- month[i] = month[j];
- income[j] = tmp;
- month[j] = temp;
- }
- }
- }
- Console.WriteLine($"\n\n|>AVERAGE-> {summ / income.Length}\n");
- }
- static void messConfirm()
- {
- Console.WriteLine("\n \t CONFIRM OPERATION \n");
- }
- static void messError()
- {
- Console.WriteLine("\n \t ERROR \n");
- }
- static int Main(string[] args)
- {
- welcome();
- string userName = inputUserName();
- string pass = inputPass();
- messWelcome(userName);
- string[] month = { "january ", "february", "march ", "april " };
- int[] income = new int[4];
- enterIncome(month, income);
- messConfirm();
- while (true)
- {
- string validUserName = inputUserName();
- string validPass = inputPass();
- if (userName == validUserName || pass == validPass)
- {
- sort(month, income);
- Console.WriteLine("INCOMES \n");
- for (int i = 0; i < income.Length; i++)
- {
- Console.WriteLine($"{ month[i]} -> {income[i] }");
- }
- break;
- }
- messError();
- }
- return 0;
- }
- }
- }
Add Comment
Please, Sign In to add comment