Hi, please check my solution, it is not correct
..
Consider the following J
Hi, please check my solution, it is not correct
..
Consider the following Java code snippet. In this code example, we have a program that takes a number and performs various conditional checks. It assigns a message based on whether the number is even, a multiple of 3, or neither. It then uses a for loop to iterate from 0 to the given number and prints whether each iteration is even or odd.
public class SomeCalculation {
public static void main(String[] args) {
int number = 15;
String message = ;
if (number % 2 == 0) {
message = Even number;
} else if (number % 3 == 0) {
message = Multiple of 3;
} else {
message = Neither even nor a multiple of 3;
}
System.out.println(Message: + message);
for (int i = 0; i < number; i++) {
if (i % 2 == 0) {
System.out.println(i + " is an even number");
} else {
System.out.println(i + " is an odd number");
}
}
}
}
Instructions
Draw a control flow graph for the above code.
Use the tool we presented in 3.2, to show :All node coverage: Include a screenshot of the execution and then suggest a possible input / expected output for each generated path.
All edge coverage: Include a screenshot of the execution and then suggest a possible input / expected output for each generated path.
Simple path coverage: Include a screenshot of the execution and then suggest a possible input / expected output for each generated path.
What to Submit?
In one file, please include
The control flow graph for the above code (25%)
Three screenshots from using the tool for the above 3 coverage criteria (75%).
Share this:FacebookX