question archive What are the test cases to cover all paths in this code? public static void main(String[] args) { //userNum is entered before this and is the user's input and is greater than or equal to 1

What are the test cases to cover all paths in this code? public static void main(String[] args) { //userNum is entered before this and is the user's input and is greater than or equal to 1

Subject:Computer SciencePrice:3.86 Bought11

What are the test cases to cover all paths in this code?

public static void main(String[] args) {

//userNum is entered before this and is the user's input and is greater than or equal to 1.

21 int limit = userNum;

22 int odd = 0;

23 int even = 0;

24 int oddSum = 0;

25 int evenSum = 0;

26 for (int count = 1; count <= limit; count++) {

27      System.out.print("t" + count + " ");

28            if (count % 2 != 0) {

29          odd++;

30          oddSum += count;

31       }

32              else {

33          even++;

34          evenSum += count;

35       }

36       if (count % 5 == 0) {

37          System.out.println();

38       }

39 } 

40 System.out.println("n# Even = " + even + " Sum = " + evenSum);

41 System.out.println("# Odd = " + odd + " Sum = " + oddSum);

42 }

Option 1

Low Cost Option
Download this past answer in few clicks

3.86 USD

PURCHASE SOLUTION

Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

rated 5 stars

Purchased 11 times

Completion Status 100%