-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathExpense.hpp
45 lines (38 loc) · 1.12 KB
/
Expense.hpp
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
#ifndef EXPENSE_HPP
#define EXPENSE_HPP
#include <string>
#include <vector>
#include <map>
#include <ctime>
enum class ExpenseType {
EQUAL,
EXACT,
PERCENT
};
class Expense {
private:
std::string expenseId;
std::string description;
double totalAmount;
std::string paidBy;
std::vector<std::string> participants;
std::map<std::string, double> shares; // userId -> share amount
ExpenseType type;
std::time_t timestamp;
public:
Expense(std::string expenseId, std::string description, double totalAmount,
std::string paidBy, const std::vector<std::string>& participants,
ExpenseType type);
std::string getExpenseId() const;
std::string getDescription() const;
double getTotalAmount() const;
std::string getPaidBy() const;
const std::vector<std::string>& getParticipants() const;
const std::map<std::string, double>& getShares() const;
ExpenseType getType() const;
std::time_t getTimestamp() const;
void setShares(const std::map<std::string, double>& shares);
void calculateEqualShares();
void displayInfo() const;
};
#endif