-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMocha.h
More file actions
38 lines (34 loc) · 703 Bytes
/
Mocha.h
File metadata and controls
38 lines (34 loc) · 703 Bytes
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
#ifndef MOCHA_H
#define MOCHA_H
#include "Beverage.h"
#include "CondimentDecorator.h"
#include <memory>
#include <string>
class Mocha : public CondimentDecorator {
public:
Mocha() = default;
Mocha(std::unique_ptr<Beverage> b) : CondimentDecorator(std::move(b)) {}
std::string getDescription() const override {
return beverage->getDescription() + ", Mocha"; }
double cost() override;
};
inline
double
Mocha::cost() {
double cost = beverage->cost();
switch (beverage->getSize()) {
case Size::TALL:
cost += .15;
break;
case Size::GRANDE:
cost += .20;
break;
case Size::VENTI:
cost += .25;
break;
default:
break;
}
return cost;
}
#endif /* ifndef MOCHA_H */