/
ppd_coin.h
58 lines (53 loc) · 1.76 KB
/
ppd_coin.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
/***********************************************************************
* COSC1076 - Advanced Programming Techniques
* Semester 2 2016 Assignment #2
* Full Name : HAN LIANG ALVIN SEE
* Student Number : S3557766
* Course Code : COSC1076
* Program Code : BP094
* Start up code provided by Paul Miller
* Some codes are adopted here with permission by an anonymous author
***********************************************************************/
#include "ppd_shared.h"
#ifndef PPD_COIN
#define PPD_COIN
#define COIN_DELIM ","
struct ppd_system;
struct ppd_node;
/**
* enumeration representing the various types of currency available in
* the system.
**/
enum denomination
{
FIVE_CENTS = 5, TEN_CENTS = 10, TWENTY_CENTS = 20, FIFTY_CENTS = 50,
ONE_DOLLAR = 100, TWO_DOLLARS = 200, FIVE_DOLLARS = 500, TEN_DOLLARS = 1000
};
/**
* represents a coin type stored in the cash register. Each demonination
* will have exactly one of these in the cash register.
**/
struct coin
{
/**
* the denomination type
**/
enum denomination denom;
/**
* the count of how many of these are in the cash register
**/
unsigned count;
};
/*Initialize cash register and set all count to 0*/
void init_cash_register(struct ppd_system *);
/*Prints the content of the cash register*/
void print_cash_register(struct ppd_system *);
/*Sets all the denom counts to 20*/
void reset_cash_register(struct ppd_system *);
/*Save any changes to file*/
BOOLEAN save_coins_to_file(struct ppd_system *);
/*handles the change calculation and generates a string showing the denoms*/
BOOLEAN handle_change(struct coin *, char *, int);
/*validates the payments being made and process the payment*/
BOOLEAN make_payment(struct ppd_system *, struct ppd_node *);
#endif