Question: ( b ) Consider the following code: 0 1 . float evaluateFitness ( float absBallAngle , float ballDistance, bool isStriker ) { 0 2 .

(b) Consider the following code:
01. float evaluateFitness(float absBallAngle, float ballDistance,
bool isStriker){
02. if (ballDistance <200.0){
03. if (absBallAngle <30.0)
04. return 1.0;
05. else
06. return 1.0-(absBallAngle 30.0)/150.0;
07.} else {
08. if (ballDistance >4000.0)
09. return 0.0;
10. else
11. return 1.0 ballDistance /4000.0;
12.}
13.}
(i) Sketch a control flow graph for the code given. Label each node
uniquely (by line number where possible) so that it can be easily
matched to the corresponding code.
(ii) Write down all independent paths through the code.
(iii) Calculate the decision coverage of a test in which ballDistance is 180
and absBallAngle is 35.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!