Estimador de festa - use a cabeça c#
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace EstimadorFestaCatarina
{
class DinnerParty : Party { private int NumberOfPeople; public decimal CostOfBeveragesPerPerson; public decimal CostOfDecorations; const int CostOfFoodPerPerson = 25;
public DinnerParty(int numberOfPeople, bool healthyOption, bool fancyDecorations) : base(numberOfPeople, fancyDecorations) { SetHealthyOption(healthyOption); CalculateCastOfDecorations(fancyDecorations); }
public void SetHealthyOption(bool healthyOption) { if (healthyOption) { CostOfBeveragesPerPerson = 5.00M; } else { CostOfBeveragesPerPerson = 20.00M; } }
public decimal CalculateCastOfDecorations(bool fancy) // Calcula o custo da decoração p/ N pessoas { if (fancy) { CostOfDecorations = (NumberOfPeople * 15.00M) + 50M; } else { CostOfDecorations = (NumberOfPeople * 7.5M) + 30M; } return CostOfDecorations; }
// Calcula o custo total acrecscentado decoração bebida comida, desconto se saldável. public decimal CalculateCost(bool healthyOption) { decimal totalCost = base.CaltulateCast() + CostOfBeveragesPerPerson * NumberOfPeople; if (healthyOption) { return totalCost * .95M; } else { return totalCost; } }
public void setPartyOptions(int people, bool fancy) { this.NumberOfPeople = people;