Define a class named Pair where the data(state) part contains two double-typed
numbers, num1 and num2. The method(behaviour) part contain the following methods:
o getSum() – returns the result of adding num1 with num2
o getdifference() – returns the result of substracting num2 from num1
o getProduct() - returns the multiplication of num1 with num2
o getAverage() – returns the average of num1 & num2
o getMax() - returns the larger of the two numbers
o getMin() – returns the smaller of the two numbers
You also need to define a constructor method as described below:

public Pair(double aFirst, double aSecond) {...}
Constructs a Pair object
parameter aFirst the first value of the pair
parameter aSecond the second value of the pair

Then write a program named PairTest that reads in two numbers (from standard
input) constructs a Pair object, invokes all of its methods and prints the results.

4 Months
Discussion Span
Last Post by happygeek

Please acquaint yourself with the rules taking particular note of "do provide evidence of having done some work yourself if posting questions from school or work assignments" and then come back with the appropriate additional information such as what problems you are having with your code, and include that code, so people can help you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.