Advertisement
Niicksana

Courier Express

Dec 3rd, 2017
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.50 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 Courier_Express
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Programming Basics Exam - 05 November 2017
  14.             double kgProduct = double.Parse(Console.ReadLine());
  15.             var service = Console.ReadLine().ToLower();
  16.             int km = int.Parse(Console.ReadLine());
  17.  
  18.             double price = 0;
  19.  
  20.             if (service == "standard")
  21.             {
  22.                 if (kgProduct < 1.00)
  23.                 {
  24.                     price = km * 0.03;
  25.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  26.                 }
  27.  
  28.                 else if (kgProduct >= 1 && kgProduct <= 10)
  29.                 {
  30.                     price = km * 0.05;
  31.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  32.                 }
  33.  
  34.                 else if (kgProduct >= 11 && kgProduct <= 40)
  35.                 {
  36.                     price = km * 0.10;
  37.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  38.                 }
  39.  
  40.                 else if (kgProduct >= 41 && kgProduct <= 90)
  41.                 {
  42.                     price = km * 0.15;
  43.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  44.                 }
  45.  
  46.                 else if (kgProduct >= 91 && kgProduct <= 150)
  47.                 {
  48.                     price = km * 0.20;
  49.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  50.                 }
  51.             }
  52.  
  53.             else
  54.             {
  55.                 if (kgProduct < 1.00)
  56.                 {
  57.                     price = (km * 0.03) + (km * (kgProduct * (0.03 * 0.80)));
  58.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  59.                 }
  60.  
  61.                 else if (kgProduct >= 1 && kgProduct <= 10)
  62.                 {
  63.                     price = (km * 0.05) + (km * (kgProduct * (0.05 * 0.40)));
  64.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  65.                 }
  66.  
  67.                 else if (kgProduct >= 11 && kgProduct <= 40)
  68.                 {
  69.                     price = (km * 0.10) + (km * (kgProduct * (0.10 * 0.05)));
  70.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  71.                 }
  72.  
  73.                 else if (kgProduct >= 41 && kgProduct <= 90)
  74.                 {
  75.                     price = (km * 0.15) + (km * (kgProduct * (0.15 * 0.02)));
  76.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  77.                 }
  78.  
  79.                 else if (kgProduct >= 91 && kgProduct <= 150)
  80.                 {
  81.                     price = (km * 0.20) + (km * (kgProduct * (0.20 * 0.01)));
  82.                     Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", kgProduct, price);
  83.                 }
  84.             }
  85.         }
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement