-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.cpp
144 lines (133 loc) · 5.75 KB
/
order.cpp
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*********************************************************************
** Program Filename: order.cpp
** Author: Anthony Silva
** Date: 02/18/2023
** Description: Implements the order class. Handles the construction of
new orders, as well as the accessor and mutator functions for the
order objects stored in the order array.
** Input: the functions are called when in the process of collecting
the order of the customer or displaying the orders to the
employee.
** Output: the variables for the order are set, or they are returned.
** Type: Implementation File
*********************************************************************/
#include <iostream>
#include <string>
#include "order.h"
using namespace std;
/*********************************************************************
** Function: Order::Order()
** Description: sets the default values for the order object.
** Parameters: None
** Pre-Conditions: an order is being placed, and new memory needs to be
made for this to occur. At the beginning of the program, the files
should be opened so that the program can be run.
** Post-Conditions: the variables of the object created can be modified
depending on the contents of the orders.
** Type: Constructor Function
*********************************************************************/
Order::Order(){
id = 0;
coffee_name = "";
coffee_size = 'N';
quantity = 0;
}
/*********************************************************************
** Function: void Order::set_id(const int id)
** Description: sets the order number of the object based on the position
in the file.
** Parameters: The order number of the order object.
** Pre-Conditions: A new order is taken.
** Post-Conditions: the order number is set for the order placed.
** Type: Mutator Function
*********************************************************************/
void Order::set_id(const int id){
this->id = id;
}
/*********************************************************************
** Function: void Order::set_coffee_name(const string coffee_name)
** Description: sets the name of the item in the order based on what
the customer wants.
** Parameters: the item ordered
** Pre-Conditions: A new order is taken.
** Post-Conditions: the name of the item ordered is set.
** Type: Mutator Function
*********************************************************************/
void Order::set_coffee_name(const string coffee_name){
this->coffee_name = coffee_name;
}
/*********************************************************************
** Function: void Order::set_coffee_size(const char coffee_size)
** Description: sets the size of the item in the order based on what
the customer wants.
** Parameters: the size of the item ordered
** Pre-Conditions: A new order is taken.
** Post-Conditions: the size of the item ordered is set.
** Type: Mutator Function
*********************************************************************/
void Order::set_coffee_size(const char coffee_size){
this->coffee_size = coffee_size;
}
/*********************************************************************
** Function: void Order::set_quantity(const int quantity)
** Description: sets the number of an item ordered into the object.
** Parameters: the number of items ordered.
** Pre-Conditions: A new order is taken.
** Post-Conditions: the number of items in an order is set.
** Type: Mutator Function
*********************************************************************/
void Order::set_quantity(const int quantity){
this->quantity = quantity;
}
/*********************************************************************
** Function: int Order::get_id() const
** Description: collects the order number of an object so that it can
be transferred to a new order array.
** Parameters: None
** Pre-Conditions: A new order is taken.
** Post-Conditions: the order number is returned so that it can be copied
to the new array.
** Type: Accessor Function
*********************************************************************/
int Order::get_id() const{
return this->id;
}
/*********************************************************************
** Function: string Order::get_coffee_name() const
** Description: collects the item of an object so that it can be
transferred to a new order array.
** Parameters: None
** Pre-Conditions: A new order is taken.
** Post-Conditions: the item in the order is returned so that it can be
copied to the new array.
** Type: Accessor Function
*********************************************************************/
string Order::get_coffee_name() const{
return this->coffee_name;
}
/*********************************************************************
** Function: char Order::get_coffee_size() const
** Description: collects the size of an item so that it can be
transferred to a new order array.
** Parameters: None
** Pre-Conditions: A new order is taken.
** Post-Conditions: the size of the item is returned so that it can be
copied to the new array.
** Type: Accessor Function
*********************************************************************/
char Order::get_coffee_size() const{
return this->coffee_size;
}
/*********************************************************************
** Function: int Order::get_quantity() const
** Description: collects the number of items ordered so that it can be
transferred to a new order array.
** Parameters: None
** Pre-Conditions: A new order is taken.
** Post-Conditions: the number of items ordered is returned so that it
can be copied to the new array.
** Type: Accessor Function
*********************************************************************/
int Order::get_quantity() const{
return this->quantity;
}