Advertisement
ktopchiev

Courier express

Nov 28th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.32 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.             var weightShipment = double.Parse(Console.ReadLine());
  14.             var service = Console.ReadLine();
  15.             var length = double.Parse(Console.ReadLine());
  16.             var allPrice = 0.0;
  17.  
  18.                 if (weightShipment < 1)
  19.                 {
  20.                     allPrice = length * 0.03;
  21.                 }
  22.                 else if (weightShipment >= 1 && weightShipment <= 10)
  23.                 {
  24.                     allPrice = length * 0.05;
  25.                 }
  26.                 else if (weightShipment >= 11 && weightShipment <= 40)
  27.                 {
  28.                     allPrice = length * 0.10;
  29.                 }
  30.                 else if (weightShipment >= 41 && weightShipment <= 90)
  31.                 {
  32.                     allPrice = length * 0.15;
  33.                 }
  34.                 else if (weightShipment >= 91 && weightShipment <= 150)
  35.                 {
  36.                     allPrice = length * 0.20;
  37.                 }
  38.            
  39.  
  40.             if (service == "express")
  41.             {
  42.                 if (weightShipment < 1)
  43.                 {
  44.                     allPrice = allPrice + 0.8 * 0.03 * length * weightShipment;
  45.                 }
  46.                 else if (weightShipment >= 1 && weightShipment <= 10)
  47.                 {
  48.                     allPrice = allPrice + 0.4 * 0.05 * length * weightShipment;
  49.                 }
  50.  
  51.                 else if (weightShipment >= 11 && weightShipment <= 40)
  52.                 {
  53.                     allPrice = allPrice + 0.05 * 0.10 * length * weightShipment;
  54.                 }
  55.  
  56.                 else if (weightShipment >= 41 && weightShipment <= 90)
  57.                 {
  58.                     allPrice = allPrice + 0.02 * 0.15 * length * weightShipment;
  59.                 }
  60.  
  61.                 else if (weightShipment >= 91 && weightShipment <= 150)
  62.                 {
  63.                     allPrice = allPrice + 0.01 * 0.20 * length * weightShipment;
  64.                 }
  65.             }
  66.  
  67.             Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", weightShipment, allPrice);
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement