TonyTroev

Mobile operator

Dec 3rd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.60 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 _03_MobileOperator
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string time = Console.ReadLine().ToLower();
  14.             string contract = Console.ReadLine().ToLower();
  15.             string internet = Console.ReadLine().ToLower();
  16.             int months = int.Parse(Console.ReadLine());
  17.             double sum = 0.0;
  18.  
  19.             if (time == "one")
  20.             {
  21.                 switch (contract)
  22.                 {
  23.                     case "small":
  24.                         sum += 9.98;
  25.                         break;
  26.                     case "middle":
  27.                         sum += 18.99;
  28.                         break;
  29.                     case "large":
  30.                         sum += 25.98;
  31.                         break;
  32.                     case "extralarge":
  33.                         sum += 35.99;
  34.                         break;
  35.                 }
  36.                 if (internet == "yes")
  37.                 {  
  38.                     if (sum <= 10.00)
  39.                     {
  40.                         sum += 5.50;
  41.                     }
  42.                     else if (sum > 10 && sum <= 30.00)
  43.                     {
  44.                         sum += 4.35;
  45.                     }
  46.                     else
  47.                     {
  48.                         sum += 3.85;
  49.                     }
  50.                 }
  51.             }
  52.             else
  53.             {
  54.                 switch (contract)
  55.                 {
  56.                     case "small":
  57.                         sum += 8.58;
  58.                         break;
  59.                     case "middle":
  60.                         sum += 17.09;
  61.                         break;
  62.                     case "large":
  63.                         sum += 23.59;
  64.                         break;
  65.                     case "extralarge":
  66.                         sum += 31.79;
  67.                         break;
  68.                 }
  69.                 if (internet == "yes")
  70.                 {
  71.                     if (sum <= 10.00)
  72.                     {
  73.                         sum += 5.50;
  74.                     }
  75.                     else if (sum > 10 && sum <= 30.00)
  76.                     {
  77.                         sum += 4.35;
  78.                     }
  79.                     else
  80.                     {
  81.                         sum += 3.85;
  82.                     }
  83.                 }
  84.                 sum -= sum * 0.0375;
  85.             }
  86.             sum *= months;
  87.             Console.WriteLine($"{sum:F2} lv.");
  88.         }
  89.     }
  90. }
Add Comment
Please, Sign In to add comment