From 4993c6468aa07e7c6a006a721fe82aaa4413eede Mon Sep 17 00:00:00 2001 From: angeld55 Date: Tue, 17 May 2022 20:42:42 +0300 Subject: added bar task --- Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.cpp | 19 +++++++++++++++++++ Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.h | 15 +++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.cpp create mode 100644 Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.h (limited to 'Sem. 11/Examples/Bar/AlcoholDrink') diff --git a/Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.cpp b/Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.cpp new file mode 100644 index 0000000..ddd890e --- /dev/null +++ b/Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.cpp @@ -0,0 +1,19 @@ +#pragma once +#include "AlcoholDrink.h" + +AlcoholDrink::AlcoholDrink():alcP(5) {} + +AlcoholDrink::AlcoholDrink(const MyString& name, int ml, int alcP) :Drink(name, ml) +{ + setAlcP(alcP); +} +void AlcoholDrink::setAlcP(int alcP) +{ + if (alcP < 5 || alcP > 98) + alcP = 50; + this->alcP = alcP; +} +int AlcoholDrink::getAlcP() const +{ + return alcP; +} \ No newline at end of file diff --git a/Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.h b/Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.h new file mode 100644 index 0000000..3029580 --- /dev/null +++ b/Sem. 11/Examples/Bar/AlcoholDrink/AlcoholDrink.h @@ -0,0 +1,15 @@ +#pragma once +#include "../Drink/Drink.h" +#include "../Queue/Queue.hpp" +#include "../Pair/Pair.hpp" + +class AlcoholDrink : public Drink +{ + int alcP; +public: + AlcoholDrink(); + AlcoholDrink(const MyString& name, int ml, int alcP); + + void setAlcP(int alcP); + int getAlcP() const; +}; \ No newline at end of file -- cgit v1.3.1-23-gd82d