Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CourierFirm
- {
- class Program
- {
- static void Main(string[] args)
- {
- double weight = double.Parse(Console.ReadLine());
- string service = Console.ReadLine();
- double distance = double.Parse(Console.ReadLine());
- double kmPrice = 0;
- if (weight < 1)
- {
- kmPrice = 0.03;
- }
- else if (weight >= 1 && weight < 10)
- {
- kmPrice = 0.05;
- }
- else if (weight >= 10 && weight < 40)
- {
- kmPrice = 0.1;
- }
- else if (weight >= 40 && weight < 90)
- {
- kmPrice = 0.15;
- }
- else if (weight >= 90 && weight < 150)
- {
- kmPrice = 0.2;
- }
- double express = 0;
- if (service == "express")
- {
- if (weight < 1)
- {
- express = kmPrice / 100 * 80;
- }
- else if (weight >= 1 && weight < 10)
- {
- express = kmPrice / 100 * 40;
- }
- else if (weight >= 10 && weight < 40)
- {
- express = kmPrice / 100 * 5;
- }
- else if (weight >= 40 && weight < 90)
- {
- express = kmPrice / 100 * 2;
- }
- else if (weight >= 90 && weight < 150)
- {
- express = kmPrice / 100 * 1;
- }
- }
- double total = kmPrice * distance + express * weight * distance;
- Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {total:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement