Advertisement
jackinman123

Untitled

Nov 23rd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12.  
  13. decimal busdistance;
  14. decimal attempts = 0;
  15. decimal traindistance;
  16. decimal taxidistance;
  17. decimal cardistance;
  18. decimal buspass;
  19. decimal taximile;
  20. decimal trainticket;
  21. string[] username = { "a", "b", "c", };
  22. string[] password = { "x", "y", "z", };
  23.  
  24.  
  25. for (int i = 0; i < 3; i++)
  26. {
  27. while (username[i] != password[i])
  28. {
  29. Console.SetWindowSize(50, 28);
  30. Console.BackgroundColor = ConsoleColor.Gray;
  31. Console.Clear();
  32. Console.ForegroundColor = ConsoleColor.Red;
  33. Console.SetCursorPosition(13, 1);
  34. Console.WriteLine("Enter Your Login Details");
  35. Console.ForegroundColor = ConsoleColor.DarkGreen;
  36. Console.SetCursorPosition(15, 6);
  37. Console.Write("Username: ");
  38. Console.ForegroundColor = ConsoleColor.Black;
  39. Console.ReadLine();
  40. Console.ForegroundColor = ConsoleColor.DarkGreen;
  41. Console.SetCursorPosition(15, 9);
  42. Console.Write("Password: ");
  43. Console.ForegroundColor = ConsoleColor.Black;
  44. Console.ReadLine();
  45. Console.WriteLine();
  46.  
  47. attempts = attempts + 1;
  48. if (attempts == 3)
  49. {
  50. break;
  51. }
  52.  
  53.  
  54. }
  55. if (attempts == 3)
  56. {
  57. Console.BackgroundColor = ConsoleColor.Red;
  58. Console.Clear();
  59. Console.SetCursorPosition(13, 13);
  60. Console.Write("You have been locked out!");
  61. Console.ReadLine();
  62. System.Environment.Exit(1);
  63. }
  64. else
  65. {
  66. Console.ForegroundColor = ConsoleColor.DarkRed;
  67. Console.SetCursorPosition(13, 12);
  68. Console.WriteLine("You have granted access");
  69. Console.ForegroundColor = ConsoleColor.DarkBlue;
  70. Console.SetCursorPosition(4, 16);
  71. Console.WriteLine("Would you like to look at the help screen?");
  72. Console.SetCursorPosition(21, 18);
  73. Console.Write("Yes or No:");
  74. string help = Console.ReadLine();
  75.  
  76. if (help == "Yes" || help == "yes")
  77. {
  78.  
  79.  
  80. Console.Clear();
  81. Console.BackgroundColor = ConsoleColor.Gray;
  82. Console.ForegroundColor = ConsoleColor.Red;
  83. Console.SetCursorPosition(23, 1);
  84. Console.WriteLine("Help");
  85. Console.ReadLine();
  86.  
  87.  
  88.  
  89. }
  90.  
  91. else
  92. {
  93.  
  94. Console.Clear();
  95. Console.BackgroundColor = ConsoleColor.Gray;
  96. Console.ForegroundColor = ConsoleColor.Red;
  97. Console.Write("What is the distance travelled by bus: ");
  98. busdistance = Convert.ToDecimal(Console.ReadLine());
  99. Console.WriteLine("The distance traveled by bus is " + busdistance);
  100.  
  101. Console.WriteLine();
  102. Console.Write("What is the distance travelled by train: ");
  103. traindistance = Convert.ToDecimal(Console.ReadLine());
  104. Console.WriteLine("The distance traveled by train is " + traindistance);
  105.  
  106. Console.WriteLine();
  107. Console.Write("What is the distance travelled by car: ");
  108. cardistance = Convert.ToDecimal(Console.ReadLine());
  109. Console.WriteLine("The distance traveled by car is " + cardistance);
  110.  
  111. Console.WriteLine();
  112. Console.Write("What is the distance travelled by taxi: ");
  113. taxidistance = Convert.ToDecimal(Console.ReadLine());
  114. Console.WriteLine("The distance traveled by taxi is " + taxidistance);
  115.  
  116. Console.WriteLine();
  117. Console.Write("What is the cost of a day bus pass: ");
  118. buspass = Convert.ToDecimal(Console.ReadLine());
  119. Console.WriteLine("The cost of a day bus pass is " + buspass);
  120.  
  121. Console.WriteLine();
  122. Console.Write("What is the cost per mile in a taxi: ");
  123. taximile = Convert.ToDecimal(Console.ReadLine());
  124. Console.WriteLine("The cost per mile with a taxi is " + taximile);
  125.  
  126. Console.WriteLine();
  127. Console.Write("What is the cost for a train ticket: ");
  128. trainticket = Convert.ToDecimal(Console.ReadLine());
  129. Console.WriteLine("The cost for a train ticket is " + trainticket);
  130.  
  131. Console.WriteLine("Click Enter to show your costings and you cheapest method.");
  132.  
  133. Console.ReadLine();
  134.  
  135.  
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement