public void chooseDrink() { int d; string number; Console.WriteLine("Choose a drink:"); Console.WriteLine("1. Beer \n" + "2. RumCoke \n" + "3. Screwdriver \n" + "4. Wine \n" + "5. Whiskey \n" + "6. Gin Tonic \n" + "7. Long Island Tea \n" + "Press Esc to exit."); if (Console.ReadKey(true).Key == ConsoleKey.Escape) { Environment.Exit(0); } number = Console.ReadKey().KeyChar.ToString(); try { d = int.Parse(number); } catch (FormatException e) { d = 0; } Drinks drink = new Drinks(aggression, moxie, humor); if (d == 1) { drink.beer(aggression, moxie, humor); aggression = drink.Aggression; moxie = drink.Moxie; humor = drink.Humor; Console.ResetColor(); Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 2) { drink.rumcoke(humor); humor = drink.Humor; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } /*if (d == 3) { drink.screwdriver(aggression); aggression = drink.Aggression; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); }*/ if (d == 4) { drink.wine(moxie); moxie = drink.Moxie; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 5) { drink.whiskey(aggression); aggression = drink.Aggression; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 6) { drink.gintonic(moxie); moxie = drink.Moxie; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 7) { drink.longislandtea(humor); humor = drink.Humor; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } Console.ReadKey(); Console.Clear(); }
public void chooseDrink() { int d; string number; Console.WriteLine("Choose a drink:"); Console.WriteLine("1. Beer \n" + "2. RumCoke \n" + "3. Screwdriver \n" + "4. Wine \n" + "5. Whiskey \n" + "6. Gin Tonic \n" + "7. Long Island Tea \n" + "Press Esc to exit."); if (Console.ReadKey(true).Key == ConsoleKey.Escape) { Environment.Exit(0); } number = Console.ReadKey().KeyChar.ToString(); try { d = int.Parse(number); } catch (FormatException e) { d = 0; } Drinks drink = new Drinks(aggression, moxie, humor); if (d == 1) { drink.beer(aggression, moxie, humor); aggression = drink.Aggression; moxie = drink.Moxie; humor = drink.Humor; Console.ResetColor(); Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 2) { drink.rumcoke(humor); humor = drink.Humor; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } /*if (d == 3) * { * drink.screwdriver(aggression); * aggression = drink.Aggression; * Console.WriteLine("Aggression:" + aggression); * Console.WriteLine("Moxie:" + moxie); * Console.WriteLine("Humor:" + humor); * }*/ if (d == 4) { drink.wine(moxie); moxie = drink.Moxie; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 5) { drink.whiskey(aggression); aggression = drink.Aggression; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 6) { drink.gintonic(moxie); moxie = drink.Moxie; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } if (d == 7) { drink.longislandtea(humor); humor = drink.Humor; Console.WriteLine("Aggression:" + aggression); Console.WriteLine("Moxie:" + moxie); Console.WriteLine("Humor:" + humor); } Console.ReadKey(); Console.Clear(); }