

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!


This project must be turned in using our web based turnin facility. This means you can turn in your project from any computer that has an Internet connection. I recommend that you use our lab when section leaders are there to help, especially for the first few. This schedule has the lab hours http://www.cs.arizona.edu/classes/cs391/spring06/gs_228_hours.htm For both problems you are asked to:
Write a unit test named EvensLeftTest that has a test method testEvensLeft to test a method named evensLeft that rearranges any array of ints such that all the even integers are in the lower portion of the array. For example, if the int array stores the following sequence of integers when the method is called: { 1 3 2 9 6 7 12 4 28 17 } the array should be rearranged to this when the method is done executing: { 2 6 12 4 28 7 1 9 3 17 } Your array may look different as long as all the even integers are on the left and all the odd integers are on the right. Here are some other examples: { 1 } { 1 } // no change { 2 } { 2 } // no change { 1 2 } { 2 1 } { 1 3 } { 1 3 } // no change { 1 3 5 } { 1 3 5 } // no change { 3 5 2 } { 2 5 3 } { 1 2 3 4 5 6 7 8 } { 2 4 6 8 5 3 7 1 } { 1 3 5 7 4 6 8 10 } { 4 6 8 10 1 3 5 7 } { 2 4 6 8 10 } { 2 4 6 8 10 } { 1 3 5 7 } { 1 3 5 7 }
Write a unit test named FrequencyTest that has a test method testFrequency to test a method named frequency that returns an array that stores the frequency of each integer in the Scanner argument. For example, if the Scanner object contains the numbers shown next, your method must return an array of ints where the value at index 100 represents the number of 100's, the value stored at index 99 represents the number of 99s found in the input stream. String numbers = "75 85 90 100 60 90 100 85 75 35 60 90 100"; numbers += " 90 90 90 60 50 70 85 75 90 90 70"; Scanner inputStream = new Scanner(numbers); Your frequency method may assume that the Scanner argument will contain any integers in the range of 0 through 100 inclusive. One assertion could look like this. int[] tests = new int[100]; tests = frequency(inputStream); assertEquals(3, tests[100]);
___/ 16 You turned in an Eclipse Project as an archive file (zipped) that is properly named and it has the following class and method name and they compile.
Go to the turnin page for instructions