Question: Draw a call graph describing program ScoreAverager. Each node in the graph is a class (and main() is a node in the graph), and an
- Draw a call graph describing program ScoreAverager. Each node in the graph is a class (and main() is a node in the graph), and an edge from class A to class B means that A uses B.
- Draw a call graph describing program ScoreAverager. In this call graph each node is a method, and an edge from method A to method B means that A invokes B.
- Show only the static information available at compile time (static class, not dynamic class).
- Remember the constructor/destructor chaining that happens with inheritance (including interface implementation).
- Remember that for statically allocated vars (e.g. scheduler in main()), the constructor and destructor are implicitly called when entering and exiting the scope in which they are declared.



Main.cpp finclude tinclude "EagerAxeragereh" finclude "LazyAxerageceh" tinclude "ScoreAxeragedUnitTestrh" sing namespace std; nt main(int args, char* argv[]) \{ IScoreAxeragec* eager = new EagerAxeragec() ; ScoreAkeragerUnitTest testEager(eager); ScoreAxeragecUnitTest testbazy(new bazyAxerager()); cout 1;; if (testEager.runtest1()) cout 1; if (testLazy.runTest1()) cout =a; \} ScoreAxeragecUnitTest:: ScoreAxeragedUnitTest(void) \{\} bool ScoreAxeragecUnitTest::checkValues(double avg, int num) \{ double epsilon =0.0000001; double computedAxg = _scoreAxeragec->getAverage(); if ((computedAxg (avg+epsilon))) return false; if (_scoreAveragec->getNumScores() != num) return false; return true; \} bool ScoreAxeragedUnitTest::runTest1() \{ \} bool ScoreAxeragecUnitTest::runTest2() \{ _scoreAxeragec->addScore(78); _scareAxeragec->addScore(90); if (I checkValues ((78+90)/2.0,2) ) return false; _scoreAxeragec->addscore(89); return (checkXaluest (78+90+89)/3.0,3)); \} IScoreAverager.h fndef ISCORE_AVERAGER_H lefine ISCORE_AVERAGER_H ass IScoreAxeragec iblic : // constructor // postcondition: getNumscores() () ' ==0 virtual void addScare(double score) =0; // precondition: score >=0 // postcondition: // getNumscorest() )== getNumscores( )+1 // getAverage ( )==( getAverage () getNumScores ()+ score )/( getNumScores ()) virtual double getAxerage ()=0; // precondition: getNumscorest ()>=0 // postcondition: // getAkerage(t)' == getAkerage() // getNumScorest() ' == getNumScores() virtual int getNumscores( )=0; // postcondition: // getAverage(t)' == getAkerage() // getNumScorest() ' == getNumScores() virtual IScoreAxerager(void) \{\} ; \begin{tabular}{|c|c|} \hline & rager.cpp \\ \hline & \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
