Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2016
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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 o3PrintAReceipt
  8. {
  9. class PrintAReceipt
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. var volume = double.Parse(Console.ReadLine());
  15. var pipe1 = double.Parse(Console.ReadLine());
  16. var pipe2 = double.Parse(Console.ReadLine());
  17. var time = double.Parse(Console.ReadLine());
  18.  
  19. var pipe1Total = pipe1 * time;
  20. var pipe2Total = pipe2 * time;
  21. var volumeTotal = pipe1Total + pipe2Total;
  22. var volumePercent = Math.Truncate(volumeTotal * 100 / volume);
  23. var pipe1Percent = Math.Truncate(pipe1Total * 100 / volumeTotal);
  24. var pipe2Percent = Math.Truncate(pipe2Total * 100 / volumeTotal);
  25. var overflow = volumeTotal - volume;
  26.  
  27. if (volumeTotal <= volume)
  28. {
  29. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", volumePercent,pipe1Percent,pipe2Percent);
  30. }
  31. else
  32. {
  33. Console.WriteLine("For {0} hours the pool overflows with {1} liters.", time, overflow);
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement