Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 12 / task1 / Drinks / AlcoholDrink.cpp
diff options
context:
space:
mode:
1 files changed, 23 insertions, 0 deletions
-rw-r--r--Sem. 12/task1/Drinks/AlcoholDrink.cpp23
diff --git a/Sem. 12/task1/Drinks/AlcoholDrink.cpp b/Sem. 12/task1/Drinks/AlcoholDrink.cpp
new file mode 100644
index 0000000..2f61087
--- /dev/null
+++ b/Sem. 12/task1/Drinks/AlcoholDrink.cpp
@@ -0,0 +1,23 @@
+#include "AlcoholDrink.h"
+
+AlcoholDrink::AlcoholDrink() : AlcoholDrink("Unknown", 0, 0){}
+
+AlcoholDrink::AlcoholDrink(const char* name, int ml, int alcoholPercentage) : Drink(name, ml)
+{
+ setAlcoholPercentage(alcoholPercentage);
+}
+int AlcoholDrink::getAlcoholPercentage() const
+{
+ return alcoholPercentage;
+}
+void AlcoholDrink::setAlcoholPercentage(int alcoholPercentage)
+{
+ const int MINPERCENTAGE = 1;
+ const int MAXPERCENTAGE = 97;
+
+ this->alcoholPercentage = MINPERCENTAGE;
+
+ if (MINPERCENTAGE <= alcoholPercentage && alcoholPercentage <= MAXPERCENTAGE)
+ this->alcoholPercentage = alcoholPercentage;
+
+} \ No newline at end of file