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:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
|
#include <iostream>
#include <stdlib.h>
using namespace std;
class containerSchiff
{
private:
int standOrt;
int anzahlContainer;
int kapazitaetContainer;
int schiff[3];
float preis_je_container;
float gesamtUmsatz;
public:
containerSchiff();
~containerSchiff();
void zeige_containerSchiff();
void veraendere_containerSchiff();
void belade_containerSchiff();
void entlade_containerSchiff();
void fahre_containerSchiff();
int gebeStandOrt();
};
//------------------------------------------------------------------------------
//Hauptprogramm
int main(void)
{
containerSchiff container1;
char wahl;
int schiff[3];
int i;
cout<<endl;
cout<<"Welches Schiff wollen sie bearbeiten?";
cin>>schiff[i];
cout<<endl;
while(wahl!='E')
{
cout<<endl;
cout<<"Auswahl"<<endl;
cout<<"========"<<endl;
cout<<"Containerschiff zeigen......1"<<endl;
cout<<"Containerschiff veraendern..2"<<endl;
cout<<"Containerschiff beladen.....3"<<endl;
cout<<"Containerschiff entladen....4"<<endl;
cout<<"Containerschiff fahren......5"<<endl;
cout<<"Standort geben..............6"<<endl;
cout<<"Ende........................E"<<endl;
cout<<"Wahl.......................:";
cin>>wahl;
switch(wahl)
{
case '1': container1.zeige_containerSchiff();break;
case '2': container1.veraendere_containerSchiff();break;
case '3': container1.belade_containerSchiff();break;
case '4': container1.entlade_containerSchiff();break;
case '5': container1.fahre_containerSchiff();break;
case '6': container1.gebeStandOrt();break;
default: system("PAUSE");
return 0;
}
}
system("PAUSE");
return 0;
}//Ende Hauptprorgamm
//------------------------------------------------------------------------------
//Implementation der Elemente
containerSchiff::containerSchiff()
{
int i;
for(i=0;i<3;i++)
{
cout<<"Definieren Sie ihr Schiff"<<endl;
cout<<"Standort: ";
cin>>standOrt;
cout<<"Anzahl Container: ";
cin>>anzahlContainer;
cout<<"Kapazitaet Container: ";
cin>>kapazitaetContainer;
cout<<"Preis je Container: ";
cin>>preis_je_container;
}
zeige_containerSchiff();
}
//------------------------------------------------------------------------------
containerSchiff::~containerSchiff()
{
cout<<"Destruktor"<<endl;
}
//------------------------------------------------------------------------------
void containerSchiff::zeige_containerSchiff()
{
float gesamtUmsatz=0;
int i;
for(i=0;i<3;i++)
{
cout<<"--------------------------------------"<<endl;
cout<<"Schiff:..............["<<i<<"]"<<endl;
cout<<"Standort: "<<standOrt<<endl;
cout<<"Anzahl Container: "<<anzahlContainer<<endl;
cout<<"Kapazitaet Container: "<<kapazitaetContainer<<endl;
cout<<"Preis je Container: "<<preis_je_container<<endl;
cout<<"Gesamtumsatz:........."<<gesamtUmsatz<<endl;
cout<<"--------------------------------------"<<endl;
}
}
//------------------------------------------------------------------------------
void containerSchiff::veraendere_containerSchiff()
{
cout<<"Standort: ";
cin>>standOrt;
cout<<"Anzahl Container: ";
cin>>anzahlContainer;
cout<<"Kapazitaet Container: ";
cin>>kapazitaetContainer;
cout<<"Preis je Container: ";
cin>>preis_je_container;
}
//------------------------------------------------------------------------------
void containerSchiff::belade_containerSchiff()
{
int zuladung_container;
if (kapazitaetContainer>anzahlContainer)
{
cout<<"Wieviel Container sollen auf das Schiff geladen werden?";
cin>>zuladung_container;
anzahlContainer=anzahlContainer+zuladung_container;
}
}
//------------------------------------------------------------------------------
void containerSchiff::entlade_containerSchiff()
{
int abladung_container;
float gesamtUmsatz=0;
cout<<"Wieviel Container sollen vom Schiff geladen werden?";
cin>>abladung_container;
anzahlContainer=anzahlContainer-abladung_container;
gesamtUmsatz=gesamtUmsatz+(abladung_container*preis_je_container);
}
//------------------------------------------------------------------------------
void containerSchiff::fahre_containerSchiff()
{
if (anzahlContainer<0)
{
cout<<"Das Schiff ist fahrbereit."<<endl;
}
else
{
cout<<"Das Schiff ist nicht fahrbereit."<<endl;
}
}
//------------------------------------------------------------------------------
int containerSchiff::gebeStandOrt()
{
cout<<"Standort: "<<standOrt<<endl;
}
//------------------------------------------------------------------------------
|