-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHasQuarterState.cpp
More file actions
41 lines (34 loc) · 735 Bytes
/
HasQuarterState.cpp
File metadata and controls
41 lines (34 loc) · 735 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
41
#include "GumballMachine.h"
#include "HasQuarterState.h"
#include <iostream>
HasQuarterState::HasQuarterState(GumballMachine *gbm)
: gumballMachine(gbm) { }
void
HasQuarterState::insertQuarter()
{
std::cout << "You can't insert another quarter\n";
}
void
HasQuarterState::ejectQuarter()
{
std::cout << "Quarter return\n";
gumballMachine->setState(gumballMachine->getNoQuarterState());
}
void
HasQuarterState::turnCrank()
{
std::cout << "You turned...\n";
gumballMachine->setState(gumballMachine->getSoldState());
}
void
HasQuarterState::dispense()
{
std::cout << "No gumball dispensed\n";
}
void
HasQuarterState::refill() { }
void
HasQuarterState::toString(std::ostream &os) const
{
os << "waiting for turn of crank";
}