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:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
|
#include <iostream>
using namespace std;
#include "CEvent.h"
CEvent::CEvent( eType type , string name ,string datetime , string location ,unsigned long int maxSeats, float pricePerTicket){
m_type = type;
m_name = name;
m_datetime = datetime;
m_location = location;
m_pricePerTicket = pricePerTicket;
if(m_maxSeats >=0 ){
m_maxSeats = maxSeats;
}
if(m_maxSeats <= 0){
m_maxSeats = 0;
}
}
eType CEvent::getType(){
return m_type;
}
string CEvent::getLocation(){
return m_location;
}
unsigned long CEvent::getNumAvailSeats(){
return m_maxSeats-m_bookedSeats;
}
string CEvent::getTypeAsString(eType type){
if(m_type = NOTYPE){
return "Unbekannter Typ";
}
if(m_type = THEATER){
return "THEATER";
}
if(m_type = ROCKPOP){
return "ROCKPOP";
}
if(m_type = SCIENCE){
return "SCIENCE";
}
if(m_type = NUMTYPES){
return "Unbekannter Typ";
}
}
void CEvent::print(unsigned long numSeats){
if (numSeats == 0){
cout << " Objektinfo: " << m_location << " " << m_type << " : " << m_datetime << " Einzelpreis : " << m_pricePerTicket << endl;
}
if (numSeats != 0){
cout << m_type << " 25x " << m_name << m_location << " : " << m_datetime << " Gesamtpreis: " << m_pricePerTicket << endl;
}
numSeats*m_pricePerTicket;
}
bool CEvent::book(unsigned long numSeats){
this->getNumAvailSeats();
if(this->getNumAvailSeats()== 0){
cout<< "Keine Plätze vorhanden "<< endl;
return false;} else {
m_bookedSeats += numSeats;
this->print(numSeats);
return true;
}
}
|