Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2021
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02.Add_Bags
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double luggageOver20KgPrice = double.Parse(Console.ReadLine());
  10.             double luggageKilograms = double.Parse(Console.ReadLine());
  11.             int daysTillTrip = int.Parse(Console.ReadLine());
  12.             int numberOfLuggage = int.Parse(Console.ReadLine());
  13.  
  14.             double luggageTax = 0;
  15.             double finalPrice = 0;
  16.  
  17.             if (luggageKilograms < 10)
  18.             {
  19.                 luggageTax = luggageOver20KgPrice * 0.20;
  20.             }
  21.             else if (luggageKilograms >= 10 && luggageKilograms <= 20)
  22.             {
  23.                 luggageTax = luggageOver20KgPrice * 0.50;
  24.             }
  25.             else if (luggageKilograms > 20)
  26.             {
  27.                 luggageTax = luggageOver20KgPrice;
  28.             }
  29.  
  30.             double increase = 0;
  31.  
  32.             if (daysTillTrip > 30)
  33.             {
  34.                 increase = luggageTax + luggageTax * 0.10;
  35.             }
  36.             else if (daysTillTrip >= 7 && daysTillTrip <= 30)
  37.             {
  38.                 increase = luggageTax + luggageTax * 0.15;
  39.             }
  40.             else if (daysTillTrip < 7)
  41.             {
  42.                 increase = luggageTax + luggageTax * 0.40;
  43.             }
  44.  
  45.             finalPrice = increase * numberOfLuggage;
  46.             Console.WriteLine($"The total price of bags is: {finalPrice:f2} lv.");
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement