-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreturnItem.cpp
43 lines (38 loc) · 1.55 KB
/
returnItem.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
//----------------------------------------------------------------------------
// ReturnItem.cpp
// Implementation:
// -- This class is responsible for updating the stock: increase the stock by
// 1. It is the Subclass f the Transaction class, get actiontype R and
// update the stock
// Assumptions:
// -- Inherits all behavior from Transaction parent class, although it has
// a unique constructor and destructor
//----------------------------------------------------------------------------
#include "returnItem.hpp"
//------------------------------constructor-----------------------------------
ReturnItem::ReturnItem() : Transaction() {
actionType = 'R';
}
//------------------------------destructor------------------------------------
ReturnItem::~ReturnItem() { }
//--------------------------------display-------------------------------------
// displays transaction and media types
void ReturnItem::display() const {
cout << mediaType << " " << actionType << " ";
}
//--------------------------------process-------------------------------------
// will process the return transaction. increases the stock of the movie held
// in inventory tree
bool ReturnItem::process(string media, Movie* movie, Customer* customer) {
if (movie != NULL){
mediaType = media;
item = movie;
item->increaseStock();
}
return true;
}
//---------------------------------create-------------------------------------
// returs a pointer to a ReturnItem transaction for factory
Transaction* ReturnItem::create() {
return new ReturnItem();
}