sources:
M07_1.cpp (302 bytes)
MCashOffice.cpp (2.0k)
MCashOffice.h (1.4k)
MRoom.cpp (4.9k)
MRoom.h (1.1k)
PrimitiveTypes.h (421 bytes)


website:
more info here
studies/bauelemente/Softwarebauelemente-CodeM7-1/MCashOffice.cpp
download file

  1 ///////////////////////////////////////////////////////////
  2 // Softwarebauelemente I, Aufgabe M6.1
  3 //
  4 // author: Stephan Brumme
  5 // last changes: November 23, 2000
  6
  7
  8 // import cout to display some data
  9 #include <iostream>
 10 #include "MCashOffice.h"
 11
 12
 13 // open std namespace
 14 using namespace std;
 15
 16
 17 void MCashOffice::Init(TCashOffice &cof, Ordinal nor, Ordinal ar, Ordinal noc)
 18 {
 19     cof.NumberOfCounter = noc;
 20     MRoom::Init(cof.Room, nor ,ar);
 21 }
 22
 23
 24 // Compares two exemplars
 25 // returns "true" if attributes of both are equal; "false" otherwise
 26 Boolean MCashOffice::EqualValue(TCashOffice cof1, TCashOffice cof2)
 27 {
 28     return ((cof1.NumberOfCounter == cof2.NumberOfCounter) &&
 29             (MRoom::EqualValue(cof1.Room, cof2.Room)))
;
 30 }
 31
 32
 33 // Copies the attributes of roo2
 34 // returns "true" if successful, "false" if no memory allocated
 35 Boolean MCashOffice::Copy(TCashOffice* cof1, TCashOffice cof2)
 36 {
 37     if ((cof1 == NULL) ||
 38         (EqualValue(*cof1, cof2)))

 39         return false;
 40
 41     cof1->NumberOfCounter = cof2.NumberOfCounter;
 42     MRoom::Copy(cof1->Room, cof2.Room);
 43     return true;
 44 }
 45
 46
 47 // Returns the NumberOfRooms attribute
 48 Ordinal MCashOffice::GetNumberOfRooms(TCashOffice cof)
 49 {
 50     return MRoom::GetNumberOfRooms(cof.Room);
 51 }
 52
 53
 54 // Sets the NumberOfRooms attribute
 55 void MCashOffice::SetNumberOfRooms(TCashOffice &cof, Ordinal nor)
 56 {
 57     MRoom::SetNumberOfRooms(cof.Room, nor);
 58 }
 59
 60
 61 // Returns the Area attribute
 62 Ordinal MCashOffice::GetArea(TCashOffice cof)
 63 {
 64     return MRoom::GetArea(cof.Room);
 65 }
 66
 67
 68 // Returns the NumberOfCounter attribute
 69 Ordinal MCashOffice::GetNumberOfCounter(TCashOffice cof)
 70 {
 71     return cof.NumberOfCounter;
 72 }
 73
 74
 75 // Sets the NumberOfCounter attribute
 76 void MCashOffice::SetNumberOfCounter(TCashOffice &cof, Ordinal nor)
 77 {
 78     cof.NumberOfCounter = nor;
 79 }
 80
 81
 82 // Displays the attributes
 83 void MCashOffice::Show(TCashOffice cof)
 84 {
 85     cout<<"Es sind "<<MRoom::GetNumberOfRooms(cof.Room)
 86         <<" Raeume mit einer Flaeche von "<<MRoom::GetArea(cof.Room)
 87         <<" an Kasse "<<cof.NumberOfCounter         <<"."<<endl;
 88 }
 89
 90 // end of namespace CashOffice
 91
 92