/// <summary> /// The method returns computed score for specified enum value of shape /// </summary> /// <param name="pizzaShape"></param> /// <returns>Returns value of score</returns> public double ComputeShapeScore(PizzaShape pizzaShape) { int result; if (pizzaShape == PizzaShape.CIRCLE) { result = 80; } else if (pizzaShape == PizzaShape.RECTANGLE) { result = 65; } else if (pizzaShape == PizzaShape.SQUARE) { result = 72; } else if (pizzaShape == PizzaShape.TRIANGLE) { result = 51; } else { result = 0; } return(result); }
/// <summary> /// <remarks> /// The arg-constructor initializes fields: name, hunger, sharpness, flavor, shape, smell. /// The constructor computes number of points for specified Pizza. /// </remarks> /// </summary> /// <param Name="name"></param> /// <param Name="Hunger"></param> /// <param Name="Sharpness"></param> /// <param Name="Flavor"></param> /// <param Name="Shape"></param> /// <param Name="Smell"></param> public Pizza(PizzaName name, int hunger, int sharpness, int flavor, PizzaShape shape, int smell) { this.Name = name; this.Hunger = hunger; this.Sharpness = sharpness; this.Flavor = flavor; this.Shape = shape; this.Smell = smell; this.Score = Math.Round(hunger * 0.87 + sharpness * 0.92 + flavor * 0.23 + ComputeShapeScore(shape) + smell * 0.43, 2); }