-
Notifications
You must be signed in to change notification settings - Fork 3
/
KitchenNightmare.cs
42 lines (37 loc) · 1.12 KB
/
KitchenNightmare.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Threading;
namespace ClassLibrary4
{
public class KitchenNightmare : Handles<Messages.PrepareFood>
{
private readonly Chef chef;
public KitchenNightmare(Chef chef)
{
this.chef = chef;
}
readonly Random random = new Random();
public void Handle(Messages.PrepareFood message)
{
var nextDouble = random.NextDouble();
if (nextDouble < 0.1)
{
Console.WriteLine("THIS SOUP");
Console.WriteLine("IS DRY!!!");
return;
}
if (nextDouble < 0.25)
{
Console.WriteLine("YOU PUT SO MUCH GINGER IN THE FOOD");
Console.WriteLine("IT HAS NO SOUL!!!");
return;
}
if (nextDouble < 0.5)
{
Console.WriteLine("THERE'S SO MUCH OIL ON");
Console.WriteLine("THE PLATE THE US IS ABOUT TO INVADE!!!");
return;
}
chef.Handle(message);
}
}
}