-
Notifications
You must be signed in to change notification settings - Fork 0
/
Inventory (1).cpp
75 lines (61 loc) · 1.51 KB
/
Inventory (1).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
// Member function definitions.
#include "Inventory.h"
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
Inventory::Inventory() //Constructor definition
{
checkInNumber=0;
workDescription=" ";
custPhone=" ";
priceQuoted=0.0;
}
void Inventory::setCheck(int checkInNumber)
{
if (checkInNumber<=0) //Second layer of data validation.
{ cout<<"ERROR: You did not enter a positive integer.\n";
exit(EXIT_FAILURE);
}
this->checkInNumber=checkInNumber;
}
int Inventory::getCheck()
{
return checkInNumber;
}
void Inventory::setWork(std::string workDescription)
{
if (workDescription.size()>=30) //Second layer of data validation.
{ cout<<"ERROR: You entered more than 29 characters.\n";
exit(EXIT_FAILURE);
}
this-> workDescription=workDescription;
}
std::string Inventory::getWork()
{
return workDescription;
}
void Inventory::setPhone(std::string custPhone)
{
if (custPhone.size()>=11) //Second layer of data validation.
{ cout<< "ERROR: You entered more than 10 characters.\n ";
exit(EXIT_FAILURE);
}
this-> custPhone=custPhone;
}
std::string Inventory::getPhone()
{
return custPhone;
}
void Inventory::setPrice(float priceQuoted)
{
if (priceQuoted<0) //Second layer of data validation.
{ cout<<"ERROR: You did not enter an integer more than or equal to 0.\n";
exit(EXIT_FAILURE);
}
this->priceQuoted=priceQuoted;
}
float Inventory::getPrice()
{
return priceQuoted;
}