Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SkiEquitment
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             double skiPrice = double.Parse(Console.ReadLine());
  11.             double shtekiPrice = double.Parse(Console.ReadLine());
  12.  
  13.             double skiBoots = skiPrice - skiPrice * 0.6;
  14.             double skiEquitment = skiPrice + skiPrice * 0.4;
  15.             double totalPrice = skiBoots + skiEquitment + skiPrice + shtekiPrice;
  16.             double finalPrice = budget - totalPrice;
  17.             double difference = totalPrice - budget;
  18.  
  19.             if (totalPrice > 800)
  20.             {
  21.                 totalPrice = skiBoots + skiEquitment + skiPrice;
  22.                 finalPrice = budget - totalPrice;
  23.             }
  24.             else
  25.             {
  26.                 totalPrice = skiPrice + shtekiPrice + skiPrice + skiBoots;
  27.                 finalPrice = budget - totalPrice;
  28.             }
  29.  
  30.             if (totalPrice <= budget)
  31.             {
  32.                 Console.WriteLine($"Angel's sum is {totalPrice:f2} lv. He has {finalPrice:f2} lv. left.");
  33.             }
  34.             else
  35.             {
  36.                 Console.WriteLine($"Not enough money! You need {difference:F2} leva more!");
  37.             }
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement