-
Notifications
You must be signed in to change notification settings - Fork 0
/
burger.cpp
48 lines (39 loc) · 1.21 KB
/
burger.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
46
// burger.cpp
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include "halfmeal.h"
#include "burger.h"
#include "ingredient.h"
#include "fooddatabase.h"
using std::string;
using std::vector;
using std::pair;
using std::cout;
using std::endl;
Burger::Burger( const FoodDatabase& fdb, const vector< pair< string, size_t > >& used, const vector< pair< string, size_t > >& haveLeft, size_t freq) : Halfmeal( freq )
{
m_burger = getIngred( "burger filling", fdb, used, haveLeft );
m_foodNames.push_back(m_burger.getName());
m_bun = fdb.getSpecificIngred("burger bread", "hamburger bun");
m_foodNames.push_back(m_bun.getName());
m_topping1 = getIngred("burger topping", fdb, used, haveLeft);
m_foodNames.push_back(m_topping1.getName());
m_topping2 = getIngred("burger topping", fdb, used, haveLeft);
m_foodNames.push_back(m_topping2.getName());
}
void Burger::printHalfmeal() const
{
cout << "Burger: " << m_burger << ", " << m_bun;
cout << ", " << m_topping1 << ", " << m_topping2;
cout << endl;
}
double Burger::getCost() const
{
double cost = 0;
cost += m_burger.getCost();
cost += m_bun.getCost();
cost += m_topping1.getCost() + m_topping2.getCost();
return cost;
}