Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

( 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions