-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmovie.cpp
35 lines (30 loc) · 877 Bytes
/
movie.cpp
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
#include "movie.h"
#include "util.h"
#include <iostream>
#include <set>
#include <string>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
Movie::Movie(const string category, const string name, double price, int qty, const string genre, const string rating):
Product(category, name, price, qty),
genre_(genre),
rating_(rating){}
set<string> Movie::keywords() const{
set<string> keyw_total;
set<string> keyw1 = parseStringToWords(name_);
keyw_total = setUnion(keyw1, keyw_total);
keyw_total.insert(convToLower(genre_));
return keyw_total;
}
string Movie::displayString()const{
string price = to_string(price_);
string qty = to_string(qty_);
return "Name: " + name_ + "\n" + " Quantity left: " +
qty + "\n" + "price: $" + price;
}
void Movie::dump(ostream& os) const{
Product::dump(os);
os<< genre_ << "\n" << rating_ <<endl;
}