-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoQuarterState.cpp
More file actions
40 lines (33 loc) · 713 Bytes
/
NoQuarterState.cpp
File metadata and controls
40 lines (33 loc) · 713 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
39
40
#include "NoQuarterState.h"
#include "GumballMachine.h"
#include <iostream>
#include <ostream>
NoQuarterState::NoQuarterState(GumballMachine *gbm) : gumballMachine(gbm) { }
void
NoQuarterState::insertQuarter()
{
std::cout << "You inseted a quarter\n";
gumballMachine->setState(gumballMachine->getHasQuarterState());
}
void
NoQuarterState::ejectQuarter()
{
std::cout << "You haven't inseted a quarter\n";
}
void
NoQuarterState::turnCrank()
{
std::cout << "You turned, but there's no quarter\n";
}
void
NoQuarterState::dispense()
{
std::cout << "You need to pay first\n";
}
void
NoQuarterState::refill() { }
void
NoQuarterState::toString(std::ostream &os) const
{
os << "waiting for turn of crank";
}