Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Dough

a guest Jul 30th, 2019 144 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace PizzaCalories
  6. {
  7.     public class Dough
  8.     {
  9.         private const double MinWeight = 1;
  10.         private const double MaxWeight = 200;
  11.  
  12.         private const double white = 1.5;
  13.         private const double wholegrain = 1.0;
  14.         private const double crispy = 0.9;
  15.         private const double chewy = 1.1;
  16.         private const double homemade = 1.0;
  17.  
  18.         private string flourType;
  19.         private string bakingTechnique;
  20.         private double weight;
  21.  
  22.         public Dough(string flourType, string bakingTechnique, double weight)
  23.         {
  24.             this.FlourType = flourType;
  25.             this.BakingTechnique = bakingTechnique;
  26.             this.Weight = weight;
  27.         }
  28.  
  29.         public string FlourType
  30.         {
  31.             get => this.flourType;
  32.             set
  33.             {
  34.                 if (value.ToLower() != "white" && value.ToLower() != "wholegrain")
  35.                 {
  36.                     throw new ArgumentException(Exceptions.InvalidDoughTypeException);
  37.                 }
  38.                 this.flourType = value;
  39.             }
  40.         }
  41.  
  42.         public string BakingTechnique
  43.         {
  44.             get => this.bakingTechnique;
  45.             set
  46.             {
  47.                 if (value.ToLower() != "crispy" && value.ToLower() != "chewy" && value.ToLower() != "homemade")
  48.                 {
  49.                     throw new ArgumentException(Exceptions.InvalidDoughTypeException);
  50.                 }
  51.                 this.bakingTechnique = value;
  52.             }
  53.         }
  54.  
  55.         public double Weight
  56.         {
  57.             get => this.weight;
  58.             set
  59.             {
  60.                 if (value < MinWeight || value > MaxWeight)
  61.                 {
  62.                     throw new ArgumentException(Exceptions.InvalidDoughWeightException);
  63.                 }
  64.                 this.weight = value;
  65.             }
  66.         }
  67.  
  68.         public double CalculateCalories()
  69.         {
  70.             double calories = 0.0;
  71.  
  72.             switch (FlourType.ToLower())
  73.             {
  74.                 case "white":
  75.                     switch (bakingTechnique.ToLower())
  76.                     {
  77.                         case "crispy": calories = 2 * this.Weight * white * crispy; break;
  78.                         case "chewy": calories = 2 * this.Weight * white * chewy; break;
  79.                         case "homemade": calories = 2 * this.Weight * white * homemade; break;
  80.                         default:
  81.                             break;
  82.                     }; break;
  83.                 case "wholegrain":
  84.                     switch (bakingTechnique.ToLower())
  85.                     {
  86.                         case "crispy": calories = 2 * this.Weight * wholegrain * crispy; break;
  87.                         case "chewy": calories = 2 * this.Weight * wholegrain * chewy; break;
  88.                         case "homemade": calories = 2 * this.Weight * wholegrain * homemade; break;
  89.                         default:
  90.                             break;
  91.                     }; break;
  92.                 default:
  93.                     break;
  94.             }
  95.  
  96.             return calories;
  97.         }
  98.     }
  99. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top