Advertisement
sanyakasarova

03. Mobile Operator

Jun 19th, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _2._Exam_Preparation
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string time = Console.ReadLine();
  10. string type = Console.ReadLine();
  11. string mobileData = Console.ReadLine(); // "yes"/"no"
  12. int months = int.Parse(Console.ReadLine());
  13.  
  14. double monthlyPrice = 0;
  15.  
  16. switch (time)
  17. {
  18. case "one":
  19. switch (type)
  20. {
  21. case "Small":
  22. monthlyPrice = 9.98;
  23. break;
  24. case "Middle":
  25. monthlyPrice = 18.99;
  26. break;
  27. case "Large":
  28. monthlyPrice = 25.98;
  29. break;
  30. case "ExtraLarge":
  31. monthlyPrice = 35.99;
  32. break;
  33. }
  34. break;
  35. case "two":
  36. switch (type)
  37. {
  38. case "Small":
  39. monthlyPrice = 8.58;
  40. break;
  41. case "Middle":
  42. monthlyPrice = 17.09;
  43. break;
  44. case "Large":
  45. monthlyPrice = 23.59;
  46. break;
  47. case "ExtraLarge":
  48. monthlyPrice = 31.79;
  49. break;
  50. }
  51. break;
  52. }
  53.  
  54. if (mobileData == "yes")
  55. {
  56. if (monthlyPrice <= 10)
  57. {
  58. monthlyPrice += 5.50;
  59. }
  60. else if (monthlyPrice <= 30)
  61. {
  62. monthlyPrice += 4.35;
  63. }
  64. else
  65. {
  66. monthlyPrice += 3.85;
  67. }
  68. }
  69.  
  70. double total = monthlyPrice * months;
  71.  
  72. if (time == "two")
  73. {
  74. total -= total * 0.0375;
  75. }
  76.  
  77. Console.WriteLine($"{total:f2} lv.");
  78. }
  79. }
  80. }
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement