Question

Use the following partial class definition as needed. public class OrderedPair {        private int x;...

Use the following partial class definition as needed.

public class OrderedPair

{

       private int x;

       private int y;

       public OrderedPair(int xValue, int yValue)

       {

              x = xValue;

              y = yValue;

       }

       public int getX()     

       {

              return x;

       }

       public int getY()

       {

              return y;

       }

public void setX(int xValue)

       {

              x = xValue;

       }

       public void setY(int yValue)

       {

              y = yValue;

       }

  1. Construct an ordered pair object called myPoint

  1. Get the x value and y value you passed in #1. Declare local variables as needed.

  1. Set a new x and y at the origin.
0 0
Add a comment Improve this question Transcribed image text
Answer #1


OrderedPair myPoint = new OrderedPair(2, 3);
int x = myPoint.getX();
int y = myPoint.getY();
myPoint.setX(0);
myPoint.setY(0);
Add a comment
Know the answer?
Add Answer to:
Use the following partial class definition as needed. public class OrderedPair {        private int x;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT