Advertisement
nadejdachitakova

MainClass

Apr 8th, 2020
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ATM
  5. {
  6. class Program {
  7.  
  8. public static void LogginIn(Client c,int inputPin)
  9. {
  10. while (c.getPin()!= inputPin) {
  11. Console.WriteLine("Please input correct pincode!");
  12. inputPin = Convert.ToInt32(Console.ReadLine());
  13. }
  14. }
  15.  
  16. public enum Servise
  17. {
  18. availableSum,
  19. payment,
  20. chek,
  21. changeOfPin
  22. }
  23. public static void AtmOption(Servise s, Client client)
  24. {
  25. double pay = Convert.ToInt32(Console.ReadLine());
  26. client.setPayment(pay);
  27. int newPin = Convert.ToInt32(Console.ReadLine());
  28. client.setPin(newPin);
  29. switch (s)
  30. {
  31. case Servise.availableSum:
  32. Console.WriteLine("you'r available sum is{0:C}", client.getAvailableSum());
  33. break;
  34. case Servise.payment:
  35. Console.WriteLine("you have selected import into account,input money{0}",pay);
  36. break;
  37. case Servise.chek:
  38. Console.WriteLine("you have selected an account verification", client.getAvailableSum());
  39. break;
  40. case Servise.changeOfPin:
  41. Console.WriteLine("u check change of pin set new pin code{}", newPin);
  42. break;
  43. default:
  44. break;
  45. }
  46. }
  47. static void Main(string[] args)
  48. {
  49. Client client = new Client();
  50. client.setPin(5532);
  51. client.setAvailableSum(530);
  52. Console.WriteLine("input pin code:");
  53. int pass = Convert.ToInt32(Console.ReadLine());
  54. LogginIn(client, pass);
  55. Console.WriteLine("Hello our ATM have option 0-available sum" +
  56. "1-payment 2-check 3 -change of pin");
  57. int op = Convert.ToInt32(Console.ReadLine());
  58. AtmOption((Servise)op, client);
  59. Console.ReadKey();
  60.  
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement