-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomer.cpp
More file actions
43 lines (35 loc) · 998 Bytes
/
Customer.cpp
File metadata and controls
43 lines (35 loc) · 998 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
42
43
#include "Customer.h"
// Purpose: Constructor initalizes all values with defaults allowing for calculations in classes which inherit this class to modify them safely
Customer::Customer() {
balance = 0.0;
meterID = 0;
totalKW = 0.0;
readings = new Reading();
}
//Default Destructor
Customer::~Customer() {}
// TODO: Method complete
// Purpose: Method takes the time input and the meter reading in kWh and stores it in the members
void Customer::addReading(int time, float kWh) {
for (int x = 0; x < sizeof(readings); x++) {
if (readings[x].getHour() == -1) {
readings[x].setHour(time);
readings[x].setMeterRead(kWh);
}
}
}
// Purpose: Gets the total readings for each customer and gets the total
// TODO: Method Complete
void Customer::totalKWh() {
for (int x = 0; x < 720; x++) {
totalKW += readings[x].getMeterRead();
}
}
// Mutator Methods
void Customer::setBalance(double bal) {
balance = bal;
}
//Acessor Methods
double Customer::getBalance() {
return balance;
}