Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class TravelDirectionTest { private static void goNorthEast(int endX, int endY, int x, int y, String route) { if (x == endX && y ==
public class TravelDirectionTest { private static void goNorthEast(int endX, int endY, int x, int y, String route) { if (x == endX && y == endY) { System.out.println(route); }else if(x <= endX && y <= endY){ goNorthEast(endX, endY, x, y + 1, route + " N"); goNorthEast(endX, endY,x + 1, y, route + " E"); goNorthEast(endX, endY,x + 1, y + 1, route + " NE"); } //OTHERWISE : DO NOTHING } public static void goNorthEast(int endX, int endY, int startX, int startY) { goNorthEast(endX, endY, startX, startY, "moves:"); } public static void intro(){ System.out.println(); System.out.println(); System.out.println("***************************************************"); System.out.println(); System.out.println(); System.out.println(" \t \t \t \t W E L C O M E "); System.out.println(); System.out.println(" \t T R A V E L T E S T P R O G R A M"); System.out.println(); System.out.println(); System.out.println("***************************************************"); System.out.println(); System.out.println(); } public static void main(String[] args) { intro(); goNorthEast(1,2, 0, 0); System.out.println(); } }
Help me do the task list into the code above.
Task List
Print out the solutions for (1, 2).
Create a solution that allows you to travel South, West and South West and returns you back to the origin from your position at (1, 2).
Print out the solutions for (1, 2) returning back to (0, 0).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started