static void Main(string[] args) { //COQUETEL 1 Coquetel coquetel1 = new Vodka("Vodka", 3); coquetel1 = new Suco(coquetel1, "Suco", 2); coquetel1 = new Gelo(coquetel1, "Gelo", 1); Console.WriteLine($"{coquetel1.getNome()} R${coquetel1.getPreco()}"); //COQUETEL 2 Coquetel coquetel2 = new Tequila("Tequila", 10); coquetel2 = new Limao(coquetel2, "Limao", 2); coquetel2 = new Acucar(coquetel2, "Acucar", 4); Console.WriteLine($"{coquetel2.getNome()} R${coquetel2.getPreco()}"); //COQUETEL 3 Coquetel coquetel3 = new Cachaca("Cachaça", 7); coquetel3 = new LeiteCondensado(coquetel3, "Leite Condensado", 8); coquetel3 = new Acucar(coquetel3, "Acucar", 4); coquetel3 = new Gelo(coquetel3, "Gelo", 1); Console.WriteLine($"{coquetel3.getNome()} R${coquetel3.getPreco()}"); Console.ReadKey(); }
public void Drink() { Beer beer = barman.PourBeer(); Vodka vodka = barman.PourVodka(); Console.WriteLine("Got my order! Enjoying: " + beer + " and " + vodka); }
public string SendRequest(Vodka Data) { NameValueCollection data = new NameValueCollection(); data = DataInjector.Foundation(data); if (this.UseAuth) { data = DataInjector.AddAuth(data, this.Username, this.Password); } data.Add("Request-Data", Vodka.Encode(Data)); return(WebSocket.SendRequest(this.URL, data)); }
public static void EX3() { ICoquetel coquetel; coquetel = new Vodka(); Console.WriteLine(coquetel.Nome + " - " + coquetel.Preco); coquetel = new Limao(coquetel); Console.WriteLine(coquetel.Nome + " - " + coquetel.Preco); coquetel = new Acucar(coquetel); Console.WriteLine(coquetel.Nome + " - " + coquetel.Preco); }
static void Main(string[] args) { // Start with creating empty object... Beer A10 = new Beer(); // ...and then assign all the date to its variables as a separate code A10.Title = "A10"; A10.Manufacturer = "Alivariya"; A10.AlcoholContentClass = AlcoholContent.MidAlcoholic; A10.PackAndVolume = new List <KeyValuePair <Packaging, double?> > { new KeyValuePair <Packaging, double?>(Packaging.Can, 0.5), new KeyValuePair <Packaging, double?>(Packaging.Glass, 0.5), new KeyValuePair <Packaging, double?>(Packaging.Plastic, 1.0), new KeyValuePair <Packaging, double?>(Packaging.Plastic, 1.5), new KeyValuePair <Packaging, double?>(Packaging.Plastic, 2.0), new KeyValuePair <Packaging, double?>(Packaging.Tap, null) }; A10.Type = BeerType.Pilsner; A10.Filtering = FilteringType.Filtered; // Create object specifying all its parameters in the constructor Beer Koronet = new Beer( "Koronet", "Lida Brewery", AlcoholContent.LowAlcoholic, new List <KeyValuePair <Packaging, double?> > { new KeyValuePair <Packaging, double?>(Packaging.Can, 0.568), new KeyValuePair <Packaging, double?>(Packaging.Glass, 0.568), new KeyValuePair <Packaging, double?>(Packaging.Plastic, 1.136), //new KeyValuePair<Packaging, double?>( Packaging.Tap, null ) }, BeerType.Pilsner, FilteringType.Filtered ); // Create object with empty constructor but specify all its parameters in the object body Beer Guinness = new Beer() { Title = "Guinness", Manufacturer = "Diageo", AlcoholContentClass = AlcoholContent.MidAlcoholic, PackAndVolume = new List <KeyValuePair <Packaging, double?> > { new KeyValuePair <Packaging, double?>(Packaging.Can, 0.5), new KeyValuePair <Packaging, double?>(Packaging.Glass, 0.5), new KeyValuePair <Packaging, double?>(Packaging.Tap, null) }, Type = BeerType.Stout, Filtering = FilteringType.Filtered }; // Show info of Beer object Guinness.ShowInfo(); // Add a couple of other derived class's objects Vodka vodka = new Vodka(); Vodka vodka2 = new Vodka(); Console.WriteLine("\nA couple of Vodka beverages has been added"); //Show total number of objects of Beverage type Beverage.ShowNumberOfBeverages(); //Show total number of objects of Beer type Beer.ShowNumberOfBeers(); Console.WriteLine(); // Compare whether one beverage contains more packaging options than other Console.WriteLine("Guinness has less packaging types than Koronet: " + (Guinness < Koronet).ToString()); Console.WriteLine("Guinness has more packaging types than Koronet: " + (Guinness > Koronet).ToString()); Console.WriteLine("Guinness has less packaging types than Koronet or equal: " + (Guinness <= Koronet).ToString()); Console.WriteLine("Guinness has more packaging types than Koronet or equal: " + (Guinness >= Koronet).ToString()); // Make console wait Console.ReadKey(); }
public static void Main(string[] args) { // setting up localization, just in case var appLocale = ConfigurationManager.AppSettings.Get("appLocale"); System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(appLocale); // declaring variables bool isProgramStarted = true; bool isCartEmpty = true; int userCommandInput; int userQtyInput; // creating null objects for further work Beer beer = null; Wine wine = null; Vodka vodka = null; Gin gin = null; Cognac cognac = null; Whisky whisky = null; // saying hello to user Console.Clear(); MessageLib.SayHello(); Console.ReadKey(); do { // showing menu to user Console.Clear(); MessageLib.Menu(); // accepting and validating input from user ParseUserInputToInt(true, out userCommandInput); switch (userCommandInput) { // adding beer to cart case (int)MenuActions.AddBeer: MessageLib.AskHowMuchBottles(); ParseUserInputToInt(false, out userQtyInput); beer = new Beer(userQtyInput); isCartEmpty = false; break; // adding wine to cart case (int)MenuActions.AddWine: MessageLib.AskHowMuchBottles(); ParseUserInputToInt(false, out userQtyInput); wine = new Wine(userQtyInput); isCartEmpty = false; break; // adding vodka to cart case (int)MenuActions.AddVodka: MessageLib.AskHowMuchBottles(); ParseUserInputToInt(false, out userQtyInput); vodka = new Vodka(userQtyInput); isCartEmpty = false; break; // adding gin to cart case (int)MenuActions.AddGin: MessageLib.AskHowMuchBottles(); ParseUserInputToInt(false, out userQtyInput); gin = new Gin(userQtyInput); isCartEmpty = false; break; // adding cognac to cart case (int)MenuActions.AddCognac: MessageLib.AskHowMuchBottles(); ParseUserInputToInt(false, out userQtyInput); cognac = new Cognac(userQtyInput); isCartEmpty = false; break; // adding whisky to cart case (int)MenuActions.AddWhisky: MessageLib.AskHowMuchBottles(); ParseUserInputToInt(false, out userQtyInput); whisky = new Whisky(userQtyInput); isCartEmpty = false; break; // showing user his cart case (int)MenuActions.ShowCart: // if cart is empty show user appropriate message if (isCartEmpty) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\nYour cart is empty!"); Console.ResetColor(); Console.WriteLine("\nPress any key to return to menu..."); Console.ReadKey(); break; } // otherwise user's cart will be processed and shown Inventory.ShowInventory(beer, wine, vodka, gin, cognac, whisky); Console.WriteLine("\nPress any key to return to menu..."); Console.ReadKey(); break; // exiting the program case (int)MenuActions.Exit: MessageLib.SayGoodbye(); isProgramStarted = false; break; // otherwise throw an error default: Console.ForegroundColor = ConsoleColor.Red; Console.Write("\nInvalid input! Please try again: "); Console.ResetColor(); break; } }while (isProgramStarted); }