-
Notifications
You must be signed in to change notification settings - Fork 0
/
GBookStore.cpp
executable file
·93 lines (86 loc) · 2.09 KB
/
GBookStore.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// GBookStore.cpp
// GBookStore
// Description CPP file of GBookStore
// Created by Swasti Gupta on 5/31/15.
//
//
#include "GBookStore.h"
#include "BookStore.h"
/*
Description GBookStore Class Constructor
*/
GBookStore :: GBookStore()
{
//assing a child class address to pointer of type interface class ABookStore
mABookStore = new BookStore();
}
/*
Description GBookStore Class Destructor
*/
GBookStore ::~GBookStore()
{
//check if pointer of interface class is already NULL otherwise deleting it
if(mABookStore != NULL)
{
delete mABookStore;
}
}
/*
param integer varialble upto which values to be printed
Description calls the private functions for printing values
Return returns the GStatus for Success otherwise GParaError for Parameter Error
*/
GStatus GBookStore ::getNValues(int n)
{
if(mABookStore != NULL)
{
// calls the child class BookStore function
return mABookStore->getNValues(n);
}
return GFail;
}
/*
param priceList file path
Description reads the priceList
Return returns the GStatus for Success otherwise GParaError for Parameter Error
*/
GStatus GBookStore ::readPriceList(char* filename)
{
if(mABookStore != NULL)
{
// calls the child class BookStore function
return mABookStore->readPriceList(filename);
}
return GFail;
}
/*
param TransactionList file path
Description reads the TransactionList file
Return returns the GStatus for Success otherwise GParaError for Parameter Error
*/
GStatus GBookStore ::readTransactionList(char* filename)
{
if(mABookStore != NULL)
{
// calls the child class BookStore function
return mABookStore->readTransactionList(filename);
}
return GFail;
}
/*
param customerId
param base Value above which discount available
param denotes the applicability of discount
Description the applicability of discount
Return returns the GStatus for Success otherwise GParaError for Parameter Error
*/
GStatus GBookStore ::isDiscount(char* custId, double value, int *discount)
{
if(mABookStore != NULL)
{
// calls the child class BookStore function
return mABookStore->isDiscount(custId,value,discount);
}
return GFail;
}