-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSandwich.h
92 lines (69 loc) · 2.3 KB
/
Sandwich.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef Sandwich_H
#define Sandwich_H
#include <string>
#include <vector>
class Sandwich {
public:
/**
* Requires: nothing
* Modifies: number_of_ingredients, meat, toppings, toasted, price, ingredients
* Effects: sets number_of_ingredients to a random int in range 2-100
*/
Sandwich();
/**
* Requires: nothing
* Modifies: nothing
* Effects: does nothing
*/
virtual ~Sandwich() = default;
/**
* Requires: nothing
* Modifies: number_of_ingredients, meat, toppings, toasted, price, ingredients
* Effects: calls choose_meat with meat,
*/
explicit Sandwich(std::string meat, std::vector<std::string> toppings, bool toasted, double price);
/**
* Requires: nothing
* Modifies: number_of_ingredients
* Effects: sets number_of_ingredients to noe if noe is in range 2-100.
* otherwise sets number_of_ingredients to 100.
*/
//sets the ingredients
void set_ingredients(std::string meat, std::vector<std::string> toppings);
//sets the value of meat
void set_meat(std::string meat);
//sets the value of topping
void add_topping(std::string topping);
//sets the value of toasted
void set_toasted(bool meat);
//sets the value of price
void set_price(double price);
//returns the value of meat
std::string get_meat();
//returns the value of topping
std::vector<std::string> get_toppings();
//returns the value of toasted
bool get_toasted() const;
//returns the value of price
double get_price() const;
/**
* Requires: nothing
* Modifies: number_of_ingredients
* Effects: if number_of_ingredients is at least 1, decrements number_of_ingredients by one and returns true.
* otherwise sets number_of_ingredients to a random number between 5 and MAX_NUMBER_EYES and returns false.
*/
//returns the ingredients in the sandwich
std::vector<std::string> get_ingredients();
//returns a formatted string with sandwich information
std::string get_sandwich();
protected:
//string meat of sandwich class
std::string meat;
//vector of toppings
std::vector<std::string> toppings;
// bool toasted of sandwich class
bool toasted;
//double price of sandwich class
double price;
};
#endif