-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclothing.cpp
More file actions
executable file
·63 lines (36 loc) · 1.21 KB
/
Copy pathclothing.cpp
File metadata and controls
executable file
·63 lines (36 loc) · 1.21 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iomanip>
#include <sstream>
#include "clothing.h"
#include "util.h"
using namespace std;
Clothing::Clothing(const string category, const string name, const string size, const string brand, double price, int qty) : Product (category, name, price, qty)
/*
Inherits data members from Product class via initialization list because those data members are initialized first when Product constructor is called
*/
{
size_ = size;
brand_ = brand;
}
/**
* default implementation...can be overriden in a future
* assignment
*/
set<string> Clothing::keywords() const {
set<string> type = parseStringToWords(name_);
set<string> label = parseStringToWords(brand_);
set<string> search_terms = setUnion(type, label);
return search_terms;
}
string Clothing::displayString() const {
stringstream ss;
ss << price_;
string cost = ss.str();
stringstream ss2;
ss2 << qty_;
string quantity = ss2.str();
string output = name_ + "\n" + "Size: " + size_ + " Brand: " + brand_ + "\n" + cost + " " + quantity + " left." + "\n";
return output;
}
void Clothing::dump(ostream& os) const {
os << category_ << "\n" << name_ << "\n" << price_ << "\n" << qty_ << "\n" << size_ << "\n" << brand_ << endl;
}