classes

classes - else if (cust->GetTransaction() ==

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include "classes.h" { name = fName; } bool CCustomer::Update () { long curTime = fClock->GetTime(); switch (fStatus) { case outside: if (fArrivalTime == curTime) { { fTeller->HelpCustomer(this); fStatus = beingServed; fInstantServed = curTime; } else { fLine->push(this); fStatus = waitingInLine; } return true; } else return false; case waitingInLine: if (fTeller->IsFree()) { fLine->pop(); fTeller->HelpCustomer(this); fStatus = beingServed; fInstantServed = curTime; return true; } else return false; case beingServed: case served: default: return false; } } void CTeller::HelpCustomer(CCustomer* cust) { fStatus = serving; fNextFreeInstant = fClock->GetTime(); if (cust->GetTransaction() == "withdrawal") fNextFreeInstant += 5;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: else if (cust->GetTransaction() == "deposit") fNextFreeInstant += 5; else if (cust->GetTransaction() == "withdrawal_deposit") fNextFreeInstant += 9; else if (cust->GetTransaction() == "new_account") fNextFreeInstant += 10; else if (cust->GetTransaction() == "complaint") fNextFreeInstant += 15; else if (cust->GetTransaction() == "others") fNextFreeInstant += 3; fCurCustomer = cust; } bool CTeller::Update () { if (fStatus == free) return false; else if (fClock->GetTime() == fNextFreeInstant) { if (fCurCustomer) ; // do nothing fCurCustomer = NULL; fStatus = free; return true; } else return false; }...
View Full Document

Page1 / 2

classes - else if (cust->GetTransaction() ==

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online