software-testing
Question 1
Create the control flow diagram and related test cases for the following program segment.
weight = get weight in pounds
height = get height in inches
BMI = (weight / (height x height)) * 703
if (BMI < 18.5)
display “underweight”
else if (BMI >= 18.5 && BMI <= 24.9)
display “healthy weight”
else if (BMI >24.9 && BMI <= 29.9)
display “overweight”
else if (BMI > 29.9)
display “Obesity”
Question 2
Create the control flow graph for the following program segment.
for (int k = 1; k <= 5; ++k)
{
if (gameCheck(stoneCount))
{
System.out.println(“You lost!”);
lostCount = lostCount + 1;
}
stoneCount = computerTurn(stoneCount);
if (gameCheck(stoneCount))
{
System.out.println(“You won”);
++winCount;
}
}