Advertisement
wingman007

ThreadBottles

Jun 2nd, 2015
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Bottles
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             double containerVolume = 100; // in lithers
  15.             int counter = 100;
  16.             do {
  17.                 Console.WriteLine("We are moving the bottle");
  18.                 Thread.Sleep(1000);
  19.                 Console.WriteLine("We are filling the bottle!");
  20.                 Thread.Sleep(2000);
  21.                 Console.WriteLine("The bottle is full!");
  22.                 Console.WriteLine("----------- New cycle! -----------");
  23.                 containerVolume -= 10.5;
  24.  
  25.                 if (containerVolume <= 0) {
  26.                     Console.WriteLine("we are filling the container :)");
  27.                     containerVolume = 100;
  28.                     Thread.Sleep(20000);
  29.                 }
  30.  
  31.             } while(true);
  32.            
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement