-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclothing.cpp
More file actions
38 lines (33 loc) · 1016 Bytes
/
clothing.cpp
File metadata and controls
38 lines (33 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "product.h"
#include "util.h"
#include <sstream>
#include "clothing.h"
using namespace std;
Clothing::Clothing(string size, string brand, string category, string name, double price, int qty ):Product(category, name, price, qty){
size_=size;
brand_=brand;
}
Clothing::~Clothing(){
}
//creates set of keywords associated with a product
std::set<std::string> Clothing::keywords() const{
std::set<std::string> set1=parseStringToWords(name_);
std::set<std::string> set2=parseStringToWords(brand_);
std::set<std::string> set3=setUnion(set1, set2);
return set3;
}
//formats product information
string Clothing::displayString() const{
ostringstream oss;
oss<<name_<<endl<<"Brand: "<<brand_<<" "<<"Size: "<<size_<<endl<<price_<<" "<<qty_<<" left."<<endl;
return oss.str();
}
//for writing information to output file
void Clothing::dump(ostream& os) const{
os<<category_<<endl;
os<<name_<<endl;
os<<price_<<endl;
os<<qty_<<endl;
os<<size_<<endl;
os<<brand_<<endl;
}