This is the assignment:

Write a Java program consisting of two files Pair.java and DemoPair.java.

The public class Pair

Has two private fields, x and y, each a double.

Has a public constructor with two double parameters that become the field values of the created object.

Has one public instance (i.e. not static) accessor method linearCombination(double a, double b) that returns the (double) value a*x+b*y.

DemoPair.java contains the main program that

Creates an array of 100 Pair's, giving each Pair constructor two double's returned by Math.random().

Uses the accessor method to compute 1 times the first x plus 100 times the first y. The main program then prints the x, y, and computed value on one line.

Uses the accessor method to compute 2 times the second x plus 99 times the second y and prints the x, y, and computed value on one line.

Uses the accessor method to compute 3 times the third x plus 98 times the third y and prints the x, y, and the computed value on one line.

...

Does the same computation and print for the sum of 100 times the 100th x and 1 times the 100th y.

Does anyone know where to start to writing the main method DemoPair? Is it possible to use a linked list for it?

Thanks