Answer the following questions. Bring hardcopies of your answers to class, hand written or printouts. All homeworks are due before class on the due date. Please remember that the GMU Honor Code is in effect: Each student is expected to work alone and you may not share solutions or solution ideas.
Consider the following program:public class firsthwk { public static int nameCheck (char[] names) { // Effects: Checks a list of names and counts how many blanks int blankCount = 0; for (int i = names.length; i > 1; i--) { if (names[i-1] == ' ') { blankCount++; } } return blankCount; } public static void main (String args[]) { // Test driver -- method calls to nameCheck() } }
main()
method to
contain calls to the nameCheck()
method
and print the result.
(Each call to the method represents one test case.)
Submit a hard-copy printout of your complete program, with your main().
names
.
The first element names[0]
is not checked,
so the method only fails if element 0 is a blank.
nameCheck()
.
Find the minimal set,
that is, turn in a set of tests such that if any one test was removed,
the remaining tests would no longer execute every statement.