consolidate all repos to one for archive
This commit is contained in:
47
semester_2/programiranje_2/naloga1001/Literature.cpp
Normal file
47
semester_2/programiranje_2/naloga1001/Literature.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "Literature.h"
|
||||
|
||||
Literature::Literature(std::string title, std::string description, int price, int year, Artist *artist, double width, double height, double depth, LiteratureType material) :
|
||||
Artwork(title, description, price, year, artist, width, height, depth), material(material) {}
|
||||
|
||||
std::string Literature::getMaterial() const{
|
||||
switch (material) {
|
||||
case LiteratureType::Drama:
|
||||
return "Drama";
|
||||
break;
|
||||
case LiteratureType::Biography:
|
||||
return "Biography";
|
||||
break;
|
||||
case LiteratureType::Poetry:
|
||||
return "Poetry";
|
||||
break;
|
||||
case LiteratureType::Prose:
|
||||
return "Prose";
|
||||
break;
|
||||
case LiteratureType::ScienceFiction:
|
||||
return "Science fiction";
|
||||
break;
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
std::string Literature::toString() const {
|
||||
return "Title: " + title +
|
||||
"\nDescription: " + description +
|
||||
"\nPrice: " + std::to_string(price) +
|
||||
" EUR\nYear: " + std::to_string(year) +
|
||||
"\nArtist: " + artist->toString() +
|
||||
"\nDimension: " + dimension.toString() +
|
||||
"\nPainting technique: " + getMaterial() + "\n\n";
|
||||
}
|
||||
|
||||
void Literature::print() const {
|
||||
std::cout <<
|
||||
"Title: " << title <<
|
||||
"\nDescription: " << description <<
|
||||
"\nPrice: " << std::to_string(price) <<
|
||||
" EUR\nYear: " << std::to_string(year) <<
|
||||
"\nArtist: " << artist->toString() <<
|
||||
"\nDimension: " << dimension.toString() <<
|
||||
"\nLiterature type: " << getMaterial() << "\n\n";
|
||||
}
|
||||
Reference in New Issue
Block a user