Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace tESt
- {
- class Program
- {
- static void Main(string[] args)
- {
- var weight = double.Parse(Console.ReadLine());
- var typeDelivery = (Console.ReadLine().ToLower());
- var km = int.Parse(Console.ReadLine());
- double costs = 0;
- if (typeDelivery == "standard")
- {
- if (weight < 1)
- {
- costs = km * 3;
- }
- else if (weight <= 10)
- {
- costs = km * 5;
- }
- else if (weight <= 40)
- {
- costs = km * 10;
- }
- else if (weight <= 90)
- {
- costs = km * 15;
- }
- else if (weight <= 150)
- {
- costs = km * 20;
- }
- else
- {
- Console.WriteLine("Error!");
- }
- }
- else
- {
- if (weight < 1)
- {
- costs = km * 3 + ( weight * km * (3 * 0.80) ); // 80%
- }
- else if (weight <= 10)
- {
- costs = km * 5 + ( weight * km * (5 * 0.40)); // 40%
- }
- else if (weight <= 40)
- {
- costs = km * 10 + ( weight * km * (10 * 0.05)); // 5%
- }
- else if (weight <= 90)
- {
- costs = km * 15 + ( weight * km * (15 * 0.02)); // 2%
- }
- else if (weight <= 150)
- {
- costs = km * 20 + ( weight * km * (20 * 0.01)); // 1%
- }
- else
- {
- Console.WriteLine("Error!");
- }
- }
- costs = costs / 100.0; // money 0.00
- Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {costs:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment