Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class Latte
  5. {
  6. public:
  7. int milkInOz;
  8. bool isMilkSteamed;
  9. int espressoBeansInOz;
  10. bool isBeansGrounded;
  11. bool isEspressoBrewed;
  12. int mugInOz;
  13. bool readyToCode;
  14.  
  15. Latte()
  16. {
  17. milkInOz = 0;
  18. isMilkSteamed = false;
  19. espressoBeansInOz = 0;
  20. isBeansGrounded = false;
  21. isEspressoBrewed = false;
  22. mugInOz = 12;
  23. readyToCode = false;
  24. }
  25.  
  26. void groundBeans()
  27. {
  28. isBeansGrounded = true;
  29. }
  30.  
  31. void brewEspresso()
  32. {
  33. isEspressoBrewed = true;
  34. mugInOz = mugInOz + (espressoBeansInOz / 2);
  35. }
  36.  
  37. void measureBeans(int inputBeansInOz)
  38. {
  39. espressoBeansInOz = inputBeansInOz;
  40. }
  41.  
  42. void measureMilk(int inputMilkInOz)
  43. {
  44. milkInOz = inputMilkInOz;
  45. }
  46.  
  47. void steamMilk()
  48. {
  49. isMilkSteamed = true;
  50. }
  51.  
  52. void pourSteamedMilk()
  53. {
  54. mugInOz = mugInOz + milkInOz;
  55. }
  56.  
  57. void chugLatte()
  58. {
  59. readyToCode = true;
  60. cout << "Nick just chugged " << (mugInOz - 12) << "oz of latte! LETS CODE! " << endl;
  61. mugInOz = 12;
  62. }
  63.  
  64. void makeLatte(int inputBeansInOz, int inputMilkInOz)
  65. {
  66. measureBeans(inputBeansInOz);
  67. if (!isBeansGrounded)
  68. {
  69. groundBeans();
  70. }
  71.  
  72. measureMilk(inputMilkInOz);
  73. if (!isMilkSteamed)
  74. {
  75. steamMilk();
  76. }
  77.  
  78. brewEspresso();
  79. pourSteamedMilk();
  80. chugLatte();
  81. }
  82. };
  83.  
  84. int main()
  85. {
  86. Latte latte;
  87. latte.makeLatte(3, 8);
  88.  
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement