Programming Assignment 6: SwapPoints Objective: To write two missing functions that manipulate objects, to complete a given program. Please complete this SwapPoints program. so it produces the sample output shown at the end of the program, without changing the main method. Make sure to follow the instructions in the comments of the program. So your job is to write the two functions below, which are missing from the program: inputNewPlayerLocation: to input (x,y) coordinates from user (using Scanner), then return a Point object with those coordinates. swapPoints: to swap the coordinates of two Point objects. (Hint: To keep the main function's reference variables relevant, you can't swap Point objects entirely. You need to change the x and y coordinates inside the Point objects.) /* Here is the Sample Output your completed program should produce: Welcome, new player. Please enter your coordinates: x: 5 y: 7 Welcome, new player. Please enter your coordinates: x: 10 y: 15 Player1 location: (5,7) Player2 location: (10,15) Player 1 and Player 2 have swapped locations! Player1 location: (10,15) Player2 location: (5,7) Welcome, new player. Please enter your coordinates: x: 20 y: 30 Welcome, new player. Please enter your coordinates: x: 3 y: 1 Player1 location: (20,30) Player2 location: (3,1) Player 1 and Player 2 have swapped locations! Player1 location: (3,1) Player2 location: (20,30) */
Programming Assignment 6: SwapPoints Objective: To write two missing functions that manipulate objects, to complete a given program. Please complete this SwapPoints program. so it produces the sample output shown at the end of the program, without changing the main method. Make sure to follow the instructions in the comments of the program. So your job is to write the two functions below, which are missing from the program: inputNewPlayerLocation: to input (x,y) coordinates from user (using Scanner), then return a Point object with those coordinates. swapPoints: to swap the coordinates of two Point objects. (Hint: To keep the main function's reference variables relevant, you can't swap Point objects entirely. You need to change the x and y coordinates inside the Point objects.) /* Here is the Sample Output your completed program should produce: Welcome, new player. Please enter your coordinates: x: 5 y: 7 Welcome, new player. Please enter your coordinates: x: 10 y: 15 Player1 location: (5,7) Player2 location: (10,15) Player 1 and Player 2 have swapped locations! Player1 location: (10,15) Player2 location: (5,7) Welcome, new player. Please enter your coordinates: x: 20 y: 30 Welcome, new player. Please enter your coordinates: x: 3 y: 1 Player1 location: (20,30) Player2 location: (3,1) Player 1 and Player 2 have swapped locations! Player1 location: (3,1) Player2 location: (20,30) */
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
Related questions
Question
Programming Assignment 6: SwapPoints
Objective: To write two missing functions that manipulate objects, to complete a given program.
- Please complete this SwapPoints program. so it produces the sample output shown at the end of the program, without changing the main method. Make sure to follow the instructions in the comments of the program. So your job is to write the two functions below, which are missing from the program:
- inputNewPlayerLocation: to input (x,y) coordinates from user (using Scanner), then return a Point object with those coordinates.
- swapPoints: to swap the coordinates of two Point objects. (Hint: To keep the main function's reference variables relevant, you can't swap Point objects entirely. You need to change the x and y coordinates inside the Point objects.)
/* Here is the Sample Output your completed program should produce:
Welcome, new player. Please enter your coordinates:
x: 5
y: 7
Welcome, new player. Please enter your coordinates:
x: 10
y: 15
Player1 location: (5,7)
Player2 location: (10,15)
Player 1 and Player 2 have swapped locations!
Player1 location: (10,15)
Player2 location: (5,7)
Welcome, new player. Please enter your coordinates:
x: 20
y: 30
Welcome, new player. Please enter your coordinates:
x: 3
y: 1
Player1 location: (20,30)
Player2 location: (3,1)
Player 1 and Player 2 have swapped locations!
Player1 location: (3,1)
Player2 location: (20,30)
*/
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,