-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbruschetta.cpp
45 lines (38 loc) · 1.26 KB
/
bruschetta.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
36
37
38
39
40
41
42
43
44
45
// bruschetta.cpp
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include "halfmeal.h"
#include "bruschetta.h"
#include "ingredient.h"
#include "fooddatabase.h"
using std::string;
using std::vector;
using std::pair;
using std::cout;
using std::endl;
Bruschetta::Bruschetta( const FoodDatabase& fdb, const vector< pair< string, size_t > >& used, const vector< pair< string, size_t > >& haveLeft, size_t freq) : Halfmeal( freq )
{
m_bread = fdb.getSpecificIngred( "bruschetta bread", "baguette" );
m_foodNames.push_back(m_bread.getName());
m_topping1 = getIngred("bruschetta topping", fdb, used, haveLeft);
m_foodNames.push_back(m_topping1.getName());
m_topping2 = getIngred("bruschetta topping", fdb, used, haveLeft);
m_foodNames.push_back(m_topping2.getName());
m_topping3 = getIngred("bruschetta topping", fdb, used, haveLeft);
m_foodNames.push_back(m_topping3.getName());
}
void Bruschetta::printHalfmeal() const
{
cout << "Bruschetta: " << m_bread.getName() << ", " << m_topping1;
cout << ", " << m_topping2 << ", " << m_topping3;
cout << endl;
}
double Bruschetta::getCost() const
{
double cost = 0;
cost += m_bread.getCost();
cost += m_topping1.getCost() + m_topping2.getCost() + m_topping3.getCost();
return cost;
}