


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Name:________________________________
The real test will look much like this one, except there will be only 7 problems. In addition to the problems below, be sure to review questions from all previous quizzes, projects, labs, and homework assignments. The test is Friday, 14 November. Problems 11 and 12 are due for homework points on Wednesday, 12 November.
1). (5 points) Write a method boolean hasDoubleLetter(String str) that returns true if str contains at least one double letter. For example,
a. Write a method int rollUntilStraight(GVdice d) that counts the number of times a GVdice must be rolled until the sequence 1, 2, 3, 4, 5, 6 is rolled in order. b. Write a method int rollUntilSmallStraight(GVdice d) that counts the number of times a GVdice must be rolled until either the sequence 1, 2, 3, 4, 5 or the sequence 2, 3, 4, 5, 6 is rolled in order. 5). Write a method int numPairs(GVdice, int num_rolls) that rolls a GVdice num_rolls times and counts the number of times two consecutive rolls have the same value. For example:
6). Write a method named onePerLine that takes an ArrayList of Strings as input and returns an ArrayList of Strings as output. The Strings in the input contain one or more names separated by spaces. The output should be an ArrayList of Strings that contains exactly one name per item. For example, if the input is {āAdam Ben Charlieā, āDave Edwardā, āFredā, āGeorgeā, āHerbert Ian Johnā}, then the output should be {āAdamā, āBenā, āCharlieā, āDaveā, āEdwardā, āFredā, āGeorgeā, āHerbertā, āIanā, āJohnā}.