#include "article.h" #include #include // Article::Article() : Entity() {} Article::Article(int price) : price_(price) {} // Article::Article(std::shared_ptr sellerPtr) : Entity() { sellerPtr_ = sellerPtr; } void Article::setArticleNo(int articleNo) { articleNo_ = articleNo; } void Article::setPrice(int price) { price_ = price; } void Article::setDescription(const std::string& description) { description_ = description; } void Article::setSale(Sale* salePtr) { salePtr_ = salePtr; } void Article::setSeller(Seller* sellerPtr) { sellerPtr_ = sellerPtr; } bool Article::isSold() { return salePtr_ ? true : false; } std::string Article::getDescription() { return description_; } Seller* Article::getSeller() { return sellerPtr_; } int Article::getPrice() const { return price_; } std::string Article::getPriceAsString() const { double sumInEuro = price_ / 100.0L; std::stringstream sumStream; sumStream << std::fixed << std::setprecision(2) << sumInEuro << " €"; return sumStream.str(); } int Article::getArticleNo() { return articleNo_; }