Advertisement
advictoriam

Untitled

Jan 17th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. public class Grades
  2. {
  3.    /**
  4.       This method examines the two arrays of test grades (double)
  5.       identified by the two parameters, and creates an array
  6.       containing the average values of these two arrays.
  7.       The test scores for each student (given in the same row in each test
  8.       array) are combined to find the average score for each student.
  9.       This average is placed in the corresponding row in the new array.
  10.       @param test1, the array of scores for the first test
  11.       @param test2, the array of scores for the second test
  12.       @return, the array containing the average scorres
  13.    */
  14.    public static double[] makeAverage(double[] test1, double[] test2)
  15.    {
  16.       double[] averages = new double[test1.length];
  17.       for(int i = 0; i < test1.length; i++)
  18.       {
  19.          averages[i] = (test1[i] + test2[i]) / 2;
  20.       }
  21.       return averages;
  22.    }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement