Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 12 / task1 / Drinks
diff options
context:
space:
mode:
Commit8cf1283a4ffb9fe1901c29c087fa376de82726af (patch)
Author
 angeld55 <angel_dimitriev@abv.bg>
2022-02-19 23:30:52 +0200
Committer
 angeld55 <angel_dimitriev@abv.bg>
2022-02-19 23:30:52 +0200
Filesabdfe6bf526100dcce87a88563100e02adf7605e /Sem. 12/task1/Drinks
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.tar
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.tar.gz
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.zip
Parentd73a7ec225516657dec74472a0491330e9999217 (diff)
clean up
diff --git a/Sem. 12/task1/Drinks/AlcoholDrink.cpp b/Sem. 12/task1/Drinks/AlcoholDrink.cpp
deleted file mode 100644
index 4171ff0..0000000
--- a/Sem. 12/task1/Drinks/AlcoholDrink.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#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;
-
-} \ No newline at end of file
diff --git a/Sem. 12/task1/Drinks/AlcoholDrink.h b/Sem. 12/task1/Drinks/AlcoholDrink.h
deleted file mode 100644
index 89b2da3..0000000
--- a/Sem. 12/task1/Drinks/AlcoholDrink.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#include "Drink.h"
-
-class AlcoholDrink : public Drink
-{
- int alcoholPercentage;
-
-public:
- AlcoholDrink();
- AlcoholDrink(const char* name, int ml, int alcoholPercentage);
-
- int getAlcoholPercentage() const;
- void setAlcoholPercentage(int alcoholPercentage);
-}; \ No newline at end of file
diff --git a/Sem. 12/task1/Drinks/Drink.cpp b/Sem. 12/task1/Drinks/Drink.cpp
deleted file mode 100644
index 55b3e3a..0000000
--- a/Sem. 12/task1/Drinks/Drink.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma warning(disable: 4996)
-#include "Drink.h"
-#include <iostream>
-
-Drink::Drink() : Drink("Unknown", 0)
-{}
-const char* Drink::getName() const
-{
- return name;
-}
-int Drink::getMl() const
-{
- return ml;
-}
-
-void Drink::setName(const char* name)
-{
- delete[] this->name;
-
- this->name = new char[strlen(name) + 1];
- strcpy(this->name, name);
-
-}
-void Drink::setMl(int ml)
-{
- const int MAX_ML = 1000;
- const int MIN_ML = 100;
-
- ml = MIN_ML;
- if (MIN_ML <= ml && ml <= MAX_ML)
- this->ml = ml;
-
-}
-
-Drink::Drink(const char* name, int ml) : name(nullptr)
-{
- setName(name);
- setMl(ml);
-}
-
-Drink::Drink(const Drink& other)
-{
- copyFrom(other);
-}
-Drink& Drink::operator = (const Drink& other)
-{
- if (this != &other)
- {
- free();
- copyFrom(other);
- }
- return *this;
-}
-Drink::~Drink()
-{
- free();
-}
-void Drink::copyFrom(const Drink& other)
-{
- name = new char[strlen(other.name) + 1];
- strcpy(name, other.name);
-
- ml = other.ml;
-}
-void Drink::free()
-{
- delete[] name;
- ml = 0;
-} \ No newline at end of file
diff --git a/Sem. 12/task1/Drinks/Drink.h b/Sem. 12/task1/Drinks/Drink.h
deleted file mode 100644
index d4d37ae..0000000
--- a/Sem. 12/task1/Drinks/Drink.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-class Drink
-{
-public:
- Drink();
-
- Drink(const char* name, int ml);
-
- Drink(const Drink& other);
- Drink& operator=(const Drink& other);
- ~Drink();
-
- const char* getName() const;
- int getMl() const;
-
- void setName(const char* name);
- void setMl(int ml);
-
-private:
- char* name;
- int ml;
-
- void copyFrom(const Drink& other);
- void free();
-
-}; \ No newline at end of file
diff --git a/Sem. 12/task1/Drinks/EnergyDrink.cpp b/Sem. 12/task1/Drinks/EnergyDrink.cpp
deleted file mode 100644
index ef61456..0000000
--- a/Sem. 12/task1/Drinks/EnergyDrink.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#pragma warning(disable: 4996)
-#include "EnergyDrink.h"
-#include <iostream>
-
-EnergyDrink::EnergyDrink(const char* name, int ml, const char* sertificate) : Drink(name, ml), qualityCertificate(nullptr)
-{
- setCertificate(sertificate);
-}
-const char* EnergyDrink::getCertifiate() const
-{
- return qualityCertificate;
-}
-void EnergyDrink::setCertificate(const char* certficate)
-{
- delete[] qualityCertificate;
-
- qualityCertificate = new char[strlen(certficate) + 1];
- strcpy(qualityCertificate, certficate);
-
-}
-EnergyDrink::EnergyDrink(const EnergyDrink& other) : Drink(other)
-{
- copyFrom(other);
-}
-
-EnergyDrink& EnergyDrink::operator=(const EnergyDrink& other)
-{
- if (this != &other)
- {
- Drink::operator=(other);
- free();
- copyFrom(other);
- }
- return *this;
-}
-
-EnergyDrink::~EnergyDrink()
-{
- free();
-}
-void EnergyDrink::copyFrom(const EnergyDrink& other)
-{
- qualityCertificate = new char[strlen(other.qualityCertificate) + 1];
- strcpy(qualityCertificate, other.qualityCertificate);
-}
-void EnergyDrink::free()
-{
- delete[] qualityCertificate;
-} \ No newline at end of file
diff --git a/Sem. 12/task1/Drinks/EnergyDrink.h b/Sem. 12/task1/Drinks/EnergyDrink.h
deleted file mode 100644
index 99bbbdb..0000000
--- a/Sem. 12/task1/Drinks/EnergyDrink.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// име, мл, сертификат за качество.
-#pragma once
-#include "Drink.h"
-
-class EnergyDrink : public Drink
-{
-private:
- char* qualityCertificate;
-
- void copyFrom(const EnergyDrink& other);
- void free();
-
-public:
- EnergyDrink(const char* name, int ml, const char* certificate);
-
- EnergyDrink(const EnergyDrink& other);
- EnergyDrink& operator=(const EnergyDrink& other);
- ~EnergyDrink();
-
- const char* getCertifiate() const;
- void setCertificate(const char* certificate);
-}; \ No newline at end of file