Advertisement
ktopchiev

Courier Express

Nov 17th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 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 shipmentWeightInKg = double.Parse(Console.ReadLine());
  14.             string type = Console.ReadLine().ToLower();
  15.             int distance = int.Parse(Console.ReadLine());
  16.             double cost = 1.0;
  17.            
  18.             if(type == "standart")
  19.             {
  20.                 if (shipmentWeightInKg < 1)
  21.                     cost = distance * 0.03;
  22.                 else if (shipmentWeightInKg >= 1 && shipmentWeightInKg <= 10)
  23.                     cost = distance * 0.05;
  24.                 else if (shipmentWeightInKg >= 11 && shipmentWeightInKg <= 40)
  25.                     cost = distance * 0.10;
  26.                 else if (shipmentWeightInKg >= 41 && shipmentWeightInKg <= 90)
  27.                     cost = distance * 0.15;
  28.                 else if (shipmentWeightInKg >= 91 && shipmentWeightInKg <= 150)
  29.                     cost = distance * 0.2;
  30.             }
  31.             else if(type == "express")
  32.             {
  33.                 if (shipmentWeightInKg < 1)
  34.                     cost = distance * 0.03 + (distance * (shipmentWeightInKg * (0.03 * 0.8)));
  35.                 else if (shipmentWeightInKg >= 1 && shipmentWeightInKg <= 10)
  36.                     cost = distance * 0.05 + (distance * (shipmentWeightInKg * (0.05 * 0.4)));
  37.                 else if (shipmentWeightInKg >= 11 && shipmentWeightInKg <= 40)
  38.                     cost = distance * 0.1 + (distance * (shipmentWeightInKg * (0.1 * 0.05)));
  39.                 else if (shipmentWeightInKg >= 41 && shipmentWeightInKg <= 90)
  40.                     cost = distance * 0.15 + (distance * (shipmentWeightInKg * (0.15 * 0.02)));
  41.                 else if (shipmentWeightInKg >= 91 && shipmentWeightInKg <= 150)
  42.                     cost = distance * 0.2 + (distance * (shipmentWeightInKg * (0.2 * 0.01)));
  43.             }
  44.             Console.WriteLine("The delivery of your shipment with weight of {0:F3} kg. would cost {1:F2} lv.", shipmentWeightInKg, cost);
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement