Question: Problem 2 Write a program that prompts the user for two x and y coordinates. The program then prints two moves that will take the

 Problem 2 Write a program that prompts the user for two

Problem 2 Write a program that prompts the user for two x and y coordinates. The program then prints two moves that will take the user from the first coordinate to the second using the shortest possible distance. Each move consists of a distance and a direction: up, down, left, right, up-left, up-right, down-left, and down-right. The directions are essentially the same as in the previous problem, though the four diagonal directions affect both the x and y coordinates. Unlike the previous problem, all distances must be positive or 0. You may use moves of distance O if you only need 1 (or O) moves to reach the destination. Hint: to find the shortest possible path, you will need to use the diagonal directions if possible. Start by deciding on a basic direction and which coordinate is closer to the target. Sample output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!