Guest User

Untitled

a guest
Mar 30th, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.31 KB | None | 0 0
  1. using System;
  2. using Microsoft.Win32;
  3.  
  4. namespace ConsoleApp1
  5. {
  6. class Program
  7. {
  8. static void welcome()
  9. {
  10. Console.WriteLine("+----------------------------------------------------------------------------------------------------+");
  11. Console.WriteLine("| _____ _____ _______ _____ |");
  12. Console.WriteLine("| /\\ \\ /\\ \\ /::\\ \\ /\\ \\ |");
  13. Console.WriteLine("| /::\\ \\ /::\\ \\ /::::\\ \\ /::\\ \\ |");
  14. Console.WriteLine("| /::::\\ \\ /::::\\ \\ /::::::\\ \\ /::::\\ \\ |");
  15. Console.WriteLine("| /::::::\\ \\ /::::::\\ \\ /::::::::\\ \\ /::::::\\ \\ |");
  16. Console.WriteLine("| /:::/\\:::\\ \\ /:::/\\:::\\ \\ /:::/~~\\:::\\ \\ /:::/\\:::\\ \\ |");
  17. Console.WriteLine("| /:::/ \\:::\\ \\ /:::/__\\:::\\ \\ /:::/ \\:::\\ \\ /:::/__\\:::\\ \\ |");
  18. Console.WriteLine("| /:::/ \\:::\\ \\ /::::\\ \\:::\\ \\ /:::/ / \\:::\\ \\ \\:::\\ \\:::\\ \\ |");
  19. Console.WriteLine("| /:::/ / \\:::\\ \\ /::::::\\ \\:::\\ \\ /:::/____/ \\:::\\____\\ ___\\:::\\ \\:::\\ \\ |");
  20. Console.WriteLine("| /:::/ / \\:::\\ ___\\ /:::/\\:::\\ \\:::\\ ___\\ |:::| | |:::| | /\\ \\:::\\ \\:::\\ \\ |");
  21. Console.WriteLine("|/:::/____/ \\:::| |/:::/__\\:::\\ \\:::| ||:::|____| |:::| |/::\\ \\:::\\ \\:::\\____\\|");
  22. Console.WriteLine("|\\:::\\ \\ /:::|____|\\:::\\ \\:::\\ /:::|____| \\:::\\ \\ /:::/ / \\:::\\ \\:::\\ \\::/ /|");
  23. Console.WriteLine("| \\:::\\ \\ /:::/ / \\:::\\ \\:::\\/:::/ / \\:::\\ \\ /:::/ / \\:::\\ \\:::\\ \\/____/ |");
  24. Console.WriteLine("| \\:::\\ \\ /:::/ / \\:::\\ \\::::::/ / \\:::\\ /:::/ / \\:::\\ \\:::\\ \\ |");
  25. Console.WriteLine("| \\:::\\ /:::/ / \\:::\\ \\::::/ / \\:::\\__/:::/ / \\:::\\ \\:::\\____\\ |");
  26. Console.WriteLine("| \\:::\\ /:::/ / \\:::\\ /:::/ / \\::::::::/ / \\:::\\ /:::/ / |");
  27. Console.WriteLine("| \\:::\\/:::/ / \\:::\\/:::/ / \\::::::/ / \\:::\\/:::/ / |");
  28. Console.WriteLine("| \\::::::/ / \\::::::/ / \\::::/ / \\::::::/ / |");
  29. Console.WriteLine("| \\::::/ / \\::::/ / \\::/____/ \\::::/ / |");
  30. Console.WriteLine("| \\::/____/ \\::/____/ ~~ \\::/ / |");
  31. Console.WriteLine("| ~~ ~~ \\/____/ |");
  32. }
  33.  
  34. static string inputUserName()
  35. {
  36. string userName;
  37. Console.WriteLine("+----------------------------------------------------------------------------------------------------+");
  38. Console.Write("|>USERNAME-> ");
  39. userName = Console.ReadLine();
  40. return userName;
  41. }
  42.  
  43. static string inputPass()
  44. {
  45. string pass;
  46. Console.Write("|>PASSWORD-> ");
  47. pass = string.Empty;
  48. ConsoleKeyInfo key;
  49. do
  50. {
  51. key = Console.ReadKey(true);
  52. if (key.Key == ConsoleKey.Enter) break;
  53. if (key.Key == ConsoleKey.Backspace)
  54. {
  55. if (pass.Length != 0)
  56. {
  57. pass = pass.Remove(pass.Length - 1);
  58. Console.Write("\b \b");
  59. }
  60. }
  61. else
  62. {
  63. pass += key.KeyChar;
  64. Console.Write("*");
  65. }
  66. } while (true);
  67.  
  68. return pass;
  69. }
  70.  
  71. static void messWelcome(string user = " ")
  72. {
  73. Console.WriteLine("\n*******************************\n");
  74. Console.WriteLine($"\t WELCOME {user.ToUpper()} \n");
  75. Console.WriteLine("*******************************");
  76. }
  77.  
  78. static int[] enterIncome(string[] month, int[] incomes)
  79. {
  80. int input;
  81. for (int i = 0; i < incomes.Length; i++)
  82. {
  83. while (true)
  84. {
  85. Console.Write($"|>INCOME FOR {month[i].ToUpper()} -> ");
  86. try
  87. {
  88. input = int.Parse(Console.ReadLine());
  89. incomes[i] = input;
  90. break;
  91. }
  92. catch (FormatException)
  93. {
  94. Console.WriteLine("\n \t ERROR \n");
  95. }
  96. }
  97. }
  98. return incomes;
  99. }
  100.  
  101. static void sort(string[] month, int[] income)
  102. {
  103. int tmp;
  104. string temp;
  105. int summ = 0;
  106.  
  107. for (int i = 0; i < income.Length; i++)
  108. {
  109.  
  110. summ += income[i];
  111. for (int j = 1; j < income.Length; j++)
  112. {
  113. if (income[i] > income[j])
  114. {
  115. tmp = income[i];
  116. temp = month[i];
  117.  
  118. income[i] = income[j];
  119. month[i] = month[j];
  120.  
  121. income[j] = tmp;
  122. month[j] = temp;
  123. }
  124. }
  125. }
  126. Console.WriteLine($"\n\n|>AVERAGE-> {summ / income.Length}\n");
  127. }
  128.  
  129. static void messConfirm()
  130. {
  131. Console.WriteLine("\n \t CONFIRM OPERATION \n");
  132. }
  133.  
  134. static void messError()
  135. {
  136. Console.WriteLine("\n \t ERROR \n");
  137. }
  138.  
  139. static int Main(string[] args)
  140. {
  141. welcome();
  142.  
  143. string userName = inputUserName();
  144. string pass = inputPass();
  145.  
  146. messWelcome(userName);
  147.  
  148. string[] month = { "january ", "february", "march ", "april " };
  149. int[] income = new int[4];
  150.  
  151. enterIncome(month, income);
  152.  
  153. messConfirm();
  154.  
  155. while (true)
  156. {
  157.  
  158. string validUserName = inputUserName();
  159. string validPass = inputPass();
  160.  
  161. if (userName == validUserName || pass == validPass)
  162. {
  163. sort(month, income);
  164.  
  165. Console.WriteLine("INCOMES \n");
  166. for (int i = 0; i < income.Length; i++)
  167. {
  168. Console.WriteLine($"{ month[i]} -> {income[i] }");
  169. }
  170.  
  171. break;
  172. }
  173.  
  174. messError();
  175.  
  176. }
  177. return 0;
  178. }
  179. }
  180. }
Add Comment
Please, Sign In to add comment