Advertisement
silvana1303

mobile operator

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