Advertisement
desislava_topuzakova

03. Mobile operator

Jul 18th, 2020
959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.01 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace _02._Odd_Occurrences
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string years = Console.ReadLine(); //"one", или "two"
  11.             string type = Console.ReadLine(); //"Small",  "Middle", "Large"или "ExtraLarge"
  12.             string hasInternet = Console.ReadLine(); //yes no
  13.             int months = int.Parse(Console.ReadLine());
  14.  
  15.             //1. ЦЕНА ЗА ДОГОВОР -> ГОДИНИТЕ И ОТ ТИП
  16.             //2. ПРОВЕРКА ЗА ИНТЕРНЕТА
  17.             //3. доп. отстъпка за 2 год
  18.             //4. ИЗЧИСЛЯВАМЕ ОБЩАТА СУМА
  19.             double priceContract = 0;
  20.             if (years == "one")
  21.             {
  22.                 //проверка за типа
  23.                 switch (type)
  24.                 {
  25.                     case "Small":
  26.                         priceContract = 9.98;
  27.                         break;
  28.                     case "Middle":
  29.                         priceContract = 18.99;
  30.                         break;
  31.                     case "Large":
  32.                         priceContract = 25.98;
  33.                         break;
  34.                     case "ExtraLarge":
  35.                         priceContract = 35.99;
  36.                         break;
  37.                 }
  38.             }
  39.             else if (years == "two")
  40.             {
  41.                 switch (type)
  42.                 {
  43.                     case "Small":
  44.                         priceContract = 8.58;
  45.                         break;
  46.                     case "Middle":
  47.                         priceContract = 17.09;
  48.                         break;
  49.                     case "Large":
  50.                         priceContract = 23.59;
  51.                         break;
  52.                     case "ExtraLarge":
  53.                         priceContract = 31.79;
  54.                         break;
  55.                 }
  56.             }
  57.  
  58.             if (hasInternet == "yes")
  59.             {
  60.                 //o при такса по-малка или равна на 10.00 лв.  5.50 лв.
  61.                 // o при такса по-малка или равна на 30.00 лв.  4.35 лв.
  62.                 //o при такса по-голяма от 30.00 лв.  3.85 лв.
  63.                 if (priceContract <= 10)
  64.                 {
  65.                     priceContract += 5.50;
  66.                 }
  67.                 else if (priceContract <= 30)
  68.                 {
  69.                     priceContract += 4.35;
  70.                 }
  71.                 else
  72.                 {
  73.                     priceContract += 3.85;
  74.                 }
  75.  
  76.             }
  77.  
  78.             if (years == "two")
  79.             {
  80.                 priceContract -= priceContract * 0.0375;
  81.             }
  82.  
  83.             //обща сума за месеците = бр.месеци по такса за 1 месец
  84.             double totalSum = months * priceContract;
  85.             Console.WriteLine($"{totalSum:F2} lv.");
  86.            
  87.  
  88.  
  89.  
  90.         }
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement