forked from workattech/mock-machine-coding-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit_service.h
More file actions
40 lines (33 loc) · 1.25 KB
/
split_service.h
File metadata and controls
40 lines (33 loc) · 1.25 KB
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
#include<vector>
#include "user.h"
class SplitService
{
/*** this map will contain all the user details with user id as key **/
unordered_map <string, User *> user_table;
/*** this table will contain all the expense details between users ***/
float **expense_table;
/*** this is a table of user ids with user seq no as index **********/
vector<string> users;
int num_of_user;
public:
SplitService(int no)
{
num_of_user = no;
expense_table = new float*[num_of_user];
for (int i = 0; i<num_of_user; i++)
{
expense_table[i] = new float[num_of_user];
}
for (int i = 0; i<num_of_user; i++)
{
for (int j = 0; j < num_of_user; j++)
expense_table[i][j] = 0.0;
}
}
int SHOW(string u, int all);
void SHOW_ALL();
void set_user_table(string user_id, User * t);
void EXPENSE_EQUAL(int total, string payer, vector <string> table);
void EXPENSE_EXACT(int total, string payer, vector <string> table, vector<int> amount);
void EXPENSE_PERCENT(int total, string payer, vector <string> table, vector<float> amount);
};