There are two problems in this homework.

Problem 1

Write a method called secondHighest that takes as input an array of integers, and returns an integer that equals the second largest integer in the array. (If there is a tie for the largest integer, then the second largest equals the largest.) The method can assume that the input array has at least two elements. This program contains a dummy method called secondHighest, and your solution should fill out the body of the method. After doing this, submit the .java file only into the dropbox in ICON called Homework1.

Problem 2

Write a method called numberOfDuplicates that takes as input an array A of integers, and returns the number of pairs (i, j) such that i is smaller than j and A[i] equals A[j]. That is, it returns the number of pairs that are duplicates. For example, for the array [8, 4, 8, 7, 8, 6, 4], the number of duplicates is 4. This program contains a dummy method called numberOfDuplicates, and your solution should fill out the body of the method. After doing this, submit the .java file only into the dropbox in ICON called Homework1.

To work on one of these problems using netBeans, you will have to open a new project on netBeans and then cut and paste the relevant stuff from the incomplete program I have written. I will explain this in class.