SHARE
TWEET

pool3

a guest Jun 19th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace pipes
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             double litPool = double.Parse(Console.ReadLine());
  10.             double p1 = double.Parse(Console.ReadLine());
  11.             double p2 = double.Parse(Console.ReadLine());
  12.             double hoursMiss = double.Parse(Console.ReadLine());
  13.  
  14.  
  15.             double water = p1 * hoursMiss + p2 * hoursMiss;
  16.  
  17.             if(water <= litPool){
  18.                 double percentOfWater = water / litPool * 100;
  19.                 double percentFirtPipe = p1 * hoursMiss / water * 100;
  20.                 double secondPipePercent = p2 * hoursMiss / water * 100;
  21.                 Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",Math.Floor(percentOfWater),
  22.                                   Math.Floor(percentFirtPipe), Math.Floor(secondPipePercent));
  23.             }
  24.  
  25.             else{
  26.                 var overflow = water - litPool;
  27.                 Console.WriteLine("For {0:0.0} hours the pool overflows with {1:0.0} liters.", hoursMiss, overflow);
  28.  
  29.             }
  30.         }
  31.     }
  32. }
RAW Paste Data
Top