Advertisement
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 Dough
- {
- private string flourType;
- private string bakingTechnique;
- private decimal weight;
- public string FlourType
- {
- get
- {
- return this.flourType;
- }
- set
- {
- if (value.ToLower() == "white" || value.ToLower() == "wholegrain")
- flourType = value.ToLower();
- else
- throw new Exception("Invalid type of dough.");
- }
- }
- public string BakingTechnique
- {
- get
- {
- return this.bakingTechnique;
- }
- set
- {
- if(value.ToLower()=="crispy"||value.ToLower()=="chewy"||value.ToLower()=="homemade")
- bakingTechnique = value.ToLower();
- else
- throw new Exception("Invalid type of dough.");
- }
- }
- public decimal Weight
- {
- get
- {
- return this.weight;
- }
- set
- {
- if(value>=1&&value<=200)
- weight = value;
- else
- throw new Exception("Dough weight should be in the range [1..200].");
- }
- }
- public decimal CaloriesCalculator()
- {
- decimal flourTypeMultiplier = 0;
- decimal bakeTypeMultiplier = 0;
- if (this.flourType.ToLower() == "white")
- flourTypeMultiplier = (decimal)1.5;
- else if (this.flourType.ToLower() == "wholegrain")
- flourTypeMultiplier = (decimal)1.0;
- if (this.bakingTechnique.ToLower() == "crispy")
- bakeTypeMultiplier = (decimal)0.9;
- else if (this.bakingTechnique.ToLower() == "chewy")
- bakeTypeMultiplier = (decimal)1.1;
- else if(this.bakingTechnique.ToLower()=="homemade")
- bakeTypeMultiplier = (decimal)1.0;
- decimal totalCaloriesForDough;
- totalCaloriesForDough = (this.Weight * 2)*flourTypeMultiplier*bakeTypeMultiplier;
- return totalCaloriesForDough;
- }
- public Dough(string flourType,string bakingTechnique,decimal weight)
- {
- this.FlourType = flourType;
- this.BakingTechnique = bakingTechnique;
- this.Weight = weight;
- }
- public Dough()
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement