Guest User

Untitled

a guest
Sep 22nd, 2019
977
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FamilyTrip
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. double budget = double.Parse(Console.ReadLine());
  11. int nightCnt = int.Parse(Console.ReadLine());
  12. double nightPrice = double.Parse(Console.ReadLine());
  13. double percent = double.Parse(Console.ReadLine());
  14.  
  15. if (nightCnt > 7)
  16.  
  17.  
  18. {
  19.  
  20. double discount = nightPrice * 0.05;
  21. double nightCntTotal = nightCnt * (nightPrice * 0.95);
  22. percent = budget * 0.02;
  23. double totalexpences = nightCntTotal + percent;
  24. double moneyleft = budget - totalexpences;
  25.  
  26. Console.WriteLine($"Ivanovi will be left with {moneyleft:f2} leva after vacation.");
  27.  
  28.  
  29. }
  30. else
  31.  
  32.  
  33. {
  34.  
  35. double nightCntTotal = nightCnt * nightPrice;
  36. percent = budget * 0.15;
  37. double totalSum = nightCntTotal + percent;
  38. double moneyNeed = totalSum - budget;
  39. Console.WriteLine($"{moneyNeed:f2} leva needed.");
  40.  
  41.  
  42. }
  43.  
  44.  
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment