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 covergage and 100% decision coverage. (Use question 2 template)
1. static int checkOpNumber(int n, string op) {
2.switch (op) {
3.case "Perfect":
int i, sum;
4.
5.sum = 0;
6.for (i=1; i < n; i++) {
7.
8.
if (n%i==0) {
sum sum + i;
9.}
10.}
11.
if (sum n){
12.return 1;
13.}
14.else return 0;
15.case "Square":
16.
17.
int sqr (int)Math.Sqrt(n);
if (sqrsqr == n) {
18.return 1;
19.}
20.else return 0;
21.}
22.return -1;
23. }
Question 3 (4 points): You are assigned to do the functional (black-box) test for function Room Move. Writing test cases for this function with the content described below. (Use question 3 template)
Function Description: This function is used for the hotel receptionist to change the guest's current room to another room.
Screen Layout:
Zoom
+ 94%
Close