Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Pizza_Calories
- {
- class Pizza
- {
- private string name;
- public List<Dough> doughs;
- public List<Toppings> toppings;
- private decimal calorieCount;
- public string Name
- {
- get
- {
- return this.name;
- }
- set
- {
- string formattedName = value.Trim();
- if (formattedName != "" && formattedName.Length >= 1 && formattedName.Length <= 10)
- this.name = value;
- else
- throw new Exception("Pizza name should be between 1 and 15 symbols.");
- }
- }
- public Pizza(string name)
- {
- this.Name = name;
- this.doughs = new List<Dough>();
- this.toppings = new List<Toppings>();
- }
- public void AddCalories(decimal caloriesToAdd)
- {
- this.calorieCount = this.calorieCount + caloriesToAdd;
- }
- public decimal GetTotalCalories()
- {
- return this.calorieCount;
- }
- }
- }
Add Comment
Please, Sign In to add comment