Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java Homework NoEffort
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
Wes Aday94.3K
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

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.
  Permalink  
Comments
Wes Aday at 8-Oct-12 22:22pm
   
Excuse me? Never learned any manners did you?
Wes Aday at 8-Oct-12 22:31pm
   
Just so you cannot delete your comment and deny your abuse, "wes aday please leave this now. Your not welcome here"
Marcus Kramer at 9-Oct-12 9:49am
   
Don't feel sad, Wes. Some of us consider you welcome here. :)
Wes Aday at 9-Oct-12 10:02am
   
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.
Wes Aday at 9-Oct-12 6:26am
   
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?
Wes Aday at 9-Oct-12 8:27am
   
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!
Wes Aday at 9-Oct-12 8:27am
   
Thanks :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100