miroslavbstoyanov

Untitled

Jun 12th, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace AssesmentTravelDayNight
  8. {
  9. class AssesmentTravelDayNight
  10. {
  11. static void Main(string[] args)
  12. {
  13. var poolVolume = int.Parse(Console.ReadLine());
  14. var pibe1 = int.Parse(Console.ReadLine());
  15. var pibe2 = int.Parse(Console.ReadLine());
  16. var hours = double.Parse(Console.ReadLine());
  17. var pibe1volue = pibe1 * hours;
  18. var pibe2volue = pibe2 * hours;
  19. var totalvolue = pibe1volue + pibe2volue;
  20.  
  21. if (totalvolue <= poolVolume)
  22. {
  23. var percent = totalvolue / poolVolume * 100;
  24. var pibe1percent = pibe1volue / totalvolue * 100;
  25. var pibe2percent = pibe2volue / totalvolue * 100;
  26.  
  27. Console.WriteLine("The pool is {0}% full. Pipe 1: {1:f0}%. Pipe 2: {2:f0}%.", percent,Math.Floor(pibe1percent), Math.Floor(pibe2percent));
  28. }
  29. else if (pibe1 + pibe2 > poolVolume)
  30. {
  31. var overfull= Math.Abs(poolVolume - totalvolue);
  32. Console.WriteLine("For {0} hours the pool overflows with {1:f1} liters.", hours, Math.Round(overfull , 2));
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment