Advertisement
Guest User

Courier Express

a guest
Dec 15th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.49 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.             double kg = double.Parse(Console.ReadLine());
  14.             string type = Console.ReadLine();
  15.             double km = double.Parse(Console.ReadLine());
  16.             var money = 0.0;
  17.             var addOn = 0.0;
  18.  
  19.             if (type == "standart")
  20.             {
  21.                 if (kg < 1)
  22.                 {
  23.                     money = 0.03;
  24.                 }
  25.                 else if (kg >= 1 && kg <= 10)
  26.                 {
  27.                     money = 0.05;
  28.                 }
  29.                 else if (kg >= 11 && kg <=40)
  30.                 {
  31.                     money = 0.1;
  32.                 }
  33.                 else if (kg >= 41 && kg <= 90)
  34.                 {
  35.                     money = 0.15;
  36.                 }
  37.                 else
  38.                 {
  39.                     money = 0.20;
  40.                 }
  41.             }
  42.             if (type == "express")
  43.             {
  44.                 if (kg < 1)
  45.                 {
  46.                     money = 0.03;
  47.                     addOn = 0.8;
  48.                 }
  49.                 else if (kg >= 1 && kg <= 10)
  50.                 {
  51.                     money = 0.05;
  52.                     addOn = 0.4;
  53.                 }
  54.                 else if (kg >= 11 && kg <= 40)
  55.                 {
  56.                     money = 0.1;
  57.                     addOn = 0.05;
  58.                 }
  59.                 else if (kg >= 41 && kg <= 90)
  60.                 {
  61.                     money = 0.15;
  62.                     addOn = 0.02;
  63.                 }
  64.                 else
  65.                 {
  66.                     money = 0.20;
  67.                     addOn = 0.01;
  68.                 }
  69.             }
  70.                        
  71.  
  72.             if (type == "express")
  73.             {
  74.                 var neshto = km * money;
  75.                 var random = addOn * money;
  76.                 var random1 = kg * random;
  77.                 var random2 = km * random1;
  78.                 var price = neshto + random2;
  79.                 Console.WriteLine($"The delivery of your shipment with weight of {kg:f3} kg. would cost {price:f2} lv.");
  80.             }
  81.             else
  82.             {
  83.                 var price = km * money;
  84.                 Console.WriteLine($"The delivery of your shipment with weight of {kg:f3} kg. would cost {price:f2} lv.");
  85.             }
  86.         }
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement