public void onAddClicked(IBeer beer) { IBeer newBeer = Dao.getData().GetNewBeer(); AssignValuesToBeer(newBeer, beer); Dao.getData().AddNewBeer(newBeer); Beers.Add(newBeer); }
public IBeerRank CreateBeerRank(decimal overallScore, decimal tasteScore, decimal lookScore, decimal smellScore, IBeer beer, decimal compositeScore, int totalReviews) { return(new BeerRank(overallScore, tasteScore, lookScore, smellScore, beer, compositeScore, totalReviews)); }
private static void printAllBeers(List <IBeer> beers) { for (int i = 0; i < beers.Count; i++) { IBeer beer = beers[i]; Console.WriteLine($"Bear number {i + 1}:"); Console.WriteLine($"{beer.Speciality} {beer.Race}\nProducent: {beer.Producent.Name}\n{beer.AlcoholPercent}% of alcohol\nDensity of wort (BLG): {beer.BLG}\nBiterness in IBU scale: {beer.IBU}\nHue in EBC scale: {beer.EBC}\nBest drink in temperature: {beer.ServingTemperature}C and to: {beer.BestBefore}\nSea story: {beer.SeaStory}\nIngredients: {beer.Ingredients}"); Console.WriteLine($"Cheers!"); Console.WriteLine($"-------------------"); } }
private void AssignValuesToBeer(IBeer newBeer, IBeer beer) { newBeer.Race = beer.Race; newBeer.Speciality = beer.Speciality; newBeer.Producent = beer.Producent; newBeer.AlcoholPercent = beer.AlcoholPercent; newBeer.IBU = beer.IBU; newBeer.EBC = beer.EBC; newBeer.ServingTemperature = beer.ServingTemperature; newBeer.BLG = beer.BLG; newBeer.BestBefore = beer.BestBefore; newBeer.SeaStory = beer.SeaStory; newBeer.Ingredients = beer.Ingredients; }
public override IBeerRank GetBeerRank(IEnumerable <IBeerReview> reviews, IBeer beer) { if (reviews == null) { throw new ArgumentNullException(nameof(reviews)); } if (beer == null) { throw new ArgumentNullException(nameof(beer)); } var beerReviews = reviews as IBeerReview[] ?? reviews.ToArray(); var reviewsCount = beerReviews.Length; if (reviewsCount == 0) { throw new ArgumentException("Reviews cannot be empty!"); } decimal aggregateScore = beerReviews.Sum(beerReview => (decimal)(OverallScoreMultiplier * beerReview.Overall + beerReview.Look + beerReview.Smell + beerReview.Taste) / (OverallScoreMultiplier + 3)); var overallAverage = GetAverageScore(beerReviews, r => r.Overall); var tasteAverage = GetAverageScore(beerReviews, r => r.Taste); var smellAverage = GetAverageScore(beerReviews, r => r.Smell); var lookverage = GetAverageScore(beerReviews, r => r.Look); var finalScore = aggregateScore / reviewsCount; var rank = this.Factory.CreateBeerRank(overallAverage, tasteAverage, lookverage, smellAverage, beer, finalScore, reviewsCount); return(rank); }
public BeerRank(decimal overallScore, decimal tasteScore, decimal lookScore, decimal smellScore, IBeer beer, decimal compositeScore, int totalReviews) { if (beer == null) { throw new ArgumentNullException(nameof(beer)); } this.OverallScore = Math.Round(overallScore, 2); this.TasteScore = Math.Round(tasteScore, 2); this.LookScore = Math.Round(lookScore, 2); this.SmellScore = Math.Round(smellScore, 2); this.Beer = beer; this.CompositeScore = Math.Round(compositeScore, 2); this.TotalReviews = totalReviews; }
public abstract IBeerRank GetBeerRank(IEnumerable <IBeerReview> reviews, IBeer beer);
public BeerProxy(Person person) { _person = person; _realBeer = new Beer(); }
public void AddNewBeer(IBeer beer) { beers.Add(beer); }
public void Fill(IBeer beer) { drink = beer.Pour(); }
public void Add(IBeer beer) { throw new System.NotImplementedException(); }
public void AddNewBeer(IBeer beer) { //adding beer to database // beers.Add(beer); }
public Beer(IBeer beers) => _beers = beers;
public EditedBeer(IBeer beer) { _beer = beer; }