-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manager.cpp
58 lines (55 loc) · 2.08 KB
/
Manager.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
// Name: Kathan Sanghavi
// ID: 201901053
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
#include "structs.h"
using namespace std;
class Manager
{
private:
long int ID;
char *Name;
Inventory* I; // Manager will have full access to this Inventory.
public:
Manager(long int ID1,char *Name1,Inventory* I1){ID = ID1; Name = Name1; I = I1;}; // constructor
void Add_item(Item *i)
{
I->Add_item(i);
}
char* Delete_item(long int Item_ID1)
{
return I->Delete_item(Item_ID1);
}
void Update_item_Rate(long int Item_ID1,float Rate1) // Replaces Item's Rate with a new rate provided in argument.
{
I->Update_item_Rate(Item_ID1,Rate1);
}
void Update_item_Quantity(long int Item_ID1,int Quantity1) // Replaces Quantities of a Item with a new Quantity provided in argument.
{
I->Update_item_Quantity(Item_ID1,Quantity1);
}
void Get_Product_Info(long int Item_ID1) // This will print the information of product.
{
Item i = I->Get_Product_Info(Item_ID1,I);
if(i.ID==-1)
{
cout<<"Product does not exist.\n";
}
else
{
cout<<"Item_ID: "<<i.ID<<"\n";
cout<<"Name: "<<i.Name<<"\n";
cout<<"Rate: "<<i.Rate<<"\n";
cout<<"Quantity: "<<i.Quantity<<"\n\n";
}
}
void change_stock(long int Item_ID,int change)// Increase or decrease number of items (Quantity of Item).
{ // Variable 'change' in the function argument should be positive number to increase the Quantity, negative number to decrease the Quantity.
I->update_stock(Item_ID,change,I);
}
// As described in ppt, I have designed Manager Class in a way such that it will not have access to Customer Database.
};