Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 12 / task1 / Drinks / AlcoholDrink.cpp
blob: 4171ff0673d310de12c6754cfa55383bc13a36a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma warning(disable: 4996)
#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;

}