to do the test.
Question 1 (3 points): Review the following class and find (at least) 6 issues in the code (i.e.,coding practice, compile errors, potential logical issues, etc.) (Use question I template)
1
2
public class SumEven Numbers {
public static void main(String[] args) {
Scanner scanner new Scanner(System.in);
System.out.print("Enter the starting number: ");
int start scanner.nextInt();
System.out.print("Enter the ending number: ");
int end scanner.nextInt();
int sum = 0;
int average:
for (int i start; i <= end; i++) {
if (i % 2 == 0) {
sum += 1;
}
10
11
12
13
14
15
16
17
18
19
20
System.out.println("The sum of even numbers from start" to "end" is sum);
}
Zoom
21 }
Question 2 (3 points): Assuming you are assigned to conduct the component test for the method below, please design and create the minimum component test cases (Unit Test case) needed to achieve 100% statement coverage and 100% decision coverage. (Use question 2 template).
This code defines a performOperation method that takes two numbers and an operation string as input. It performs the specified operation (addition, subtraction, multiplication, or division) and returns the result. It includes logging for each operation, as well as error handling for various scenarios.
+ 100%
}
Close