Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. 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.
  2. 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.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

What are the purposes of collection messages? (Objective 5)

Answered: 1 week ago