Advertisement
silvana1303

family trip

Apr 27th, 2020
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace exampreparation
  4.  
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             double budget = double.Parse(Console.ReadLine());
  11.             int nightStays = int.Parse(Console.ReadLine());
  12.             double pricePerNight = double.Parse(Console.ReadLine());
  13.             int percenteExp = int.Parse(Console.ReadLine());
  14.  
  15.             if (nightStays > 7)
  16.             {
  17.                 pricePerNight *= 0.95;
  18.             }
  19.  
  20.             double stayPrice = (nightStays * pricePerNight) + budget * (percenteExp / 100.0);
  21.  
  22.             if (stayPrice <= budget)
  23.             {
  24.                 Console.WriteLine($"Ivanovi will be left with {budget - stayPrice:f2} leva after vacation.");
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine($"{stayPrice - budget:f2} leva needed.");
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement