Advertisement
Guest User

Untitled

a guest
May 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Learning
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.WriteLine("Welcome. The purpose of this application is to show how I code!");
  14. Console.WriteLine("Please enter your name:");
  15. string personName = Console.ReadLine();
  16. Console.WriteLine("Hello, " + personName + ". Press enter to continue");
  17. Console.ReadLine();
  18. bool allowedAccess = verificationCheck();
  19. Console.ReadLine();
  20. }
  21.  
  22. public static bool verificationCheck()
  23. {
  24. string logonPW = "Test123";
  25. bool logonSuccess = false;
  26. int logonAttempt = 0;
  27. Console.WriteLine("Please enter the password:");
  28. string pwPovided = Console.ReadLine();
  29. while (logonSuccess == false)
  30. {
  31. if (pwPovided == logonPW)
  32. {
  33. Console.WriteLine("Correct, Welcome to the app");
  34. logonSuccess = true;
  35. return true;
  36. }
  37. else
  38. {
  39. Console.WriteLine("Incorrect. Access Denied. Try again!");
  40. logonAttempt++;
  41. Console.WriteLine("You have used " + logonAttempt + " out of 5 attempts!");
  42. logonSuccess = false;
  43. }
  44. return false;
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement