Advertisement
GStepanov

PoolPipes

Aug 18th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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 _02.PoolPipes_Exam26._03._2016
  8. {
  9. class PoolPipes
  10. {
  11. static void Main(string[] args)
  12. {
  13. double poolVolume = double.Parse(Console.ReadLine());
  14. double firstPipeDebit = double.Parse(Console.ReadLine());
  15. double secondPipeDebit = double.Parse(Console.ReadLine());
  16. double missingHoursWorker = double.Parse(Console.ReadLine());
  17.  
  18. double totalDebit = (firstPipeDebit + secondPipeDebit) * missingHoursWorker;
  19. if (poolVolume >= totalDebit)
  20. {
  21. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", Math.Truncate((totalDebit / poolVolume) * 100),
  22. Math.Truncate((firstPipeDebit * missingHoursWorker) / totalDebit * 100), Math.Truncate((secondPipeDebit * missingHoursWorker) / totalDebit * 100));
  23. }
  24. else if (poolVolume < totalDebit)
  25. {
  26. Console.WriteLine("For {0} hours the pool overflows with {1:f1} liters.", missingHoursWorker, totalDebit - poolVolume);
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement