11,434,695 members (49,113 online)
Rate this:
See more:
Write a program that prompts the user for two numbers then points.
The sum
The difference
The product
the average
the distance (absolute value of the difference)
the maximum (the larger of the two)
the minimum (the smaller of the two)

To do so
implement a class
public class fair
{
Constructs a pair.
@param aFirst the first value of the pair.
@param Asecond the second value of the pair.

public Pair(double aFirst, double aSecond){. . .}
/**
Computes the sum of the values of this pair.
@return the sum of the first and second values
*/ public double getSum() {. . .}
...
}

INSTRUCTIONS
The PairTest.java program should use bullet proof input to prompt and collect the two values for the number pair from the user, create a number pair object using these values, display the initial values and should output the computed 7 listed computed values .

Extra Credit option:
include additional code in the driver (PairTest) that creates a pair with two random double values between 0 and 10 inclusive. Be sure to show the two pair values as well as the computed values. (In other words, the user should be able to confirm that the program is correct using the Random numbers by inspecting the output.)
Posted 8-Oct-12 17:08pm
Edited 9-Oct-12 2:07am
v3

Rate this:

## Solution 1

This is your homework. You will learn a lot more if you actually try and do it yourself. We can help you if you get stuck with a specific problem but we are not here to do it for you.

Excuse me? Never learned any manners did you?

Marcus Kramer at 9-Oct-12 9:49am

Don't feel sad, Wes. Some of us consider you welcome here. :)

Thanks Marcus. I have been so distraught over not being welcome here. I have been waiting for the police to show up though just to find out what they would charge me with. Felony not answering homework? Not doing someone's homework for them in the first degree? Maybe reckless not helping someone cheat?
TorstenH. at 9-Oct-12 3:14am

do it yourself. it's as simple.

If you want pre written code check the Java tutorials @ oracle.com.

We are professionals, you would have to pay us to write your code.

Go ahead and call the police. What do you think that they will charge me with?
Mohibur Rashid at 9-Oct-12 7:11am

is this reunion of police? will sting be there?

I hope so.... fewer grenades needed... :-)
TorstenH. at 9-Oct-12 7:23am

+5 for the "NoEffort" tag - I didn't know we have such one. great!

Thanks :-)