Advertisement
Somo4k

02. Safari

Jun 15th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02._Safari
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double budget = double.Parse(Console.ReadLine());
  10. double gasNeeded = double.Parse(Console.ReadLine());
  11. string dayOfTheWeek = Console.ReadLine();
  12.  
  13. double totalWorth = gasNeeded * 2.10 + 100;
  14.  
  15. if (dayOfTheWeek == "Sunday")
  16. {
  17. totalWorth *= 0.80;
  18. }
  19. else
  20. {
  21. totalWorth *= 0.90;
  22. }
  23.  
  24. if (budget >= totalWorth)
  25. {
  26. Console.WriteLine($"Safari time! Money left: {budget - totalWorth:f2} lv.");
  27. }
  28. else
  29. {
  30. Console.WriteLine($"Not enough money! Money needed: { Math.Abs(budget - totalWorth):f2} lv.");
  31. }
  32. }
  33. }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement