nikolayneykov

Untitled

Oct 6th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2.  
  3. class WaterDispenser
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int cupVolume = int.Parse(Console.ReadLine());
  8.         int filledVolume = 0;
  9.         int tappedCount = 0;
  10.         while (filledVolume < cupVolume)
  11.         {
  12.             string button = Console.ReadLine();
  13.             switch (button)
  14.             {
  15.                 case "Easy": filledVolume += 50; break;
  16.                 case "Medium": filledVolume += 100; break;
  17.                 case "Hard": filledVolume += 200; break;
  18.             }
  19.             tappedCount++;
  20.         }
  21.         Console.WriteLine(filledVolume == cupVolume ?
  22.             $"The dispenser has been tapped {tappedCount} times." :
  23.             $"{filledVolume - cupVolume}ml has been spilled.");
  24.     }
  25. }
Add Comment
Please, Sign In to add comment