Skip to content

Instantly share code, notes, and snippets.

@dnkm
Last active April 6, 2016 05:33
Show Gist options
  • Save dnkm/f1e915e24d0606d8a52991519769afd3 to your computer and use it in GitHub Desktop.
Save dnkm/f1e915e24d0606d8a52991519769afd3 to your computer and use it in GitHub Desktop.
homework1
import java.lang.*;
class Homework1 {
public static void main(String args[]) {
int[] testArray = new int[10];
// exercise 1
fillWithRandomIntegers(testArray, 0, 100);
printArray(testArray);
// exercise 2
int max = getMax(testArray);
System.out.println("Max is " + max);
// exercise 3
reverseArray(testArray);
printArray(testArray);
}
private static void fillWithRandomIntegers(int[] array, int min, int max) {
/* fills array with random integers between min and max */
/* implement */
}
private static void printArray(int [] array) {
/* prints the array */
/* implement */
}
private static int getMax(int[] array) {
/* returns the maximum integer from the array */
/* implement */
}
private static void reverseArray(int[] array) {
/* reverses the array */
/* implement */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment