Answer:
import java.util.Scanner;
public class UnitTesting {
// Function returns origNum cubed
public static int cubeNum(int origNum) {
return origNum * origNum * origNum;
}
public static void main (String [] args) {
System.out.println("Testing started");
System.out.println("2, expecting 8, got: " + cubeNum(2));
System.out.println("3, expecting 27, got: " + cubeNum(3));
System.out.println("-1, expecting -1, got: " + cubeNum(-1));
System.out.println("Testing completed");
return;
}
}
Step-by-step explanation:
Added statements are highlighted.
Since the cubeNum function calculates the cube of the given number and we are asked to write two statements to test inputs 3 and -1, pass the parameters 3 and -1 to the function called cubeNum and print the results using print statements