Advertisement
Guest User

Pool Pipes

a guest
Nov 22nd, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. class PoolPipes
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int volumeOfThePool = int.Parse(Console.ReadLine());
  8.         int firstPipeDebit = int.Parse(Console.ReadLine());
  9.         int secondPipeDebit = int.Parse(Console.ReadLine());
  10.         double hours = double.Parse(Console.ReadLine());
  11.  
  12.         double firstFilledPipe = hours * firstPipeDebit;
  13.         double secondFilledPipe = hours * secondPipeDebit;
  14.         double filledPool = (firstFilledPipe + secondFilledPipe);
  15.  
  16.         double percentageFilledPool = (filledPool / volumeOfThePool) * 100;
  17.         double perecentageFilledFirstPipe = (firstFilledPipe / filledPool) * 100;
  18.         double percentageFilledSecondPipe = (secondFilledPipe / filledPool) * 100;
  19.  
  20.         if (filledPool <= volumeOfThePool)
  21.         {
  22.             Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", (int)(percentageFilledPool), (int)(perecentageFilledFirstPipe),  (int)(percentageFilledSecondPipe));
  23.         }
  24.         else
  25.         {
  26.             Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hours, filledPool - volumeOfThePool);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement