Question: Write a method named swapPoints that accepts two Points as parameters and swaps their x/y values. Consider the following example code that calls swapPoints: $p1
Write a method named swapPoints that accepts two Points as parameters and swaps their x/y values. Consider the following example code that calls swapPoints: $p1 = new Point(5, 2); $p2 = new Point(-3, 6); swapPoints(p1, p2); echo "(" . p1.x . ", " . p1.y . ")"; echo "(" . p2.x . ", " . p2.y . ")"; The output produced from the above code should be: (-3, 6) (5, 2) In PHP. How it's possible to write this method and echo it out?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
