Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Courier_Express
- {
- class Program
- {
- static void Main(string[] args)
- {
- double shipmentWeightInKg = double.Parse(Console.ReadLine());
- string type = Console.ReadLine().ToLower();
- int distance = int.Parse(Console.ReadLine());
- double cost = 1.0;
- if(type == "standart")
- {
- if (shipmentWeightInKg < 1)
- cost = distance * 0.03;
- else if (shipmentWeightInKg >= 1 && shipmentWeightInKg <= 10)
- cost = distance * 0.05;
- else if (shipmentWeightInKg >= 11 && shipmentWeightInKg <= 40)
- cost = distance * 0.10;
- else if (shipmentWeightInKg >= 41 && shipmentWeightInKg <= 90)
- cost = distance * 0.15;
- else if (shipmentWeightInKg >= 91 && shipmentWeightInKg <= 150)
- cost = distance * 0.2;
- }
- else if(type == "express")
- {
- if (shipmentWeightInKg < 1)
- cost = distance * 0.03 + (distance * (shipmentWeightInKg * (0.03 * 0.8)));
- else if (shipmentWeightInKg >= 1 && shipmentWeightInKg <= 10)
- cost = distance * 0.05 + (distance * (shipmentWeightInKg * (0.05 * 0.4)));
- else if (shipmentWeightInKg >= 11 && shipmentWeightInKg <= 40)
- cost = distance * 0.1 + (distance * (shipmentWeightInKg * (0.1 * 0.05)));
- else if (shipmentWeightInKg >= 41 && shipmentWeightInKg <= 90)
- cost = distance * 0.15 + (distance * (shipmentWeightInKg * (0.15 * 0.02)));
- else if (shipmentWeightInKg >= 91 && shipmentWeightInKg <= 150)
- cost = distance * 0.2 + (distance * (shipmentWeightInKg * (0.2 * 0.01)));
- }
- Console.WriteLine("The delivery of your shipment with weight of {0:F3} kg. would cost {1:F2} lv.", shipmentWeightInKg, cost);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement