id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2022_11_03_HL_newPosition
prev  |  next  |  chance

Write a method that accepts the x and y values of an initial point and a string representing the 'moves' to be made. Each move consists of a letter 'U' for up, 'D' for down, 'L' for left, and 'R' for right. You need to return a string that represents the coordinates of the final point you reach after making all the 'moves'. Look at the test data for examples and to see how each move changes the coordinates. As preconditions you may assume that 'moves' will ONLY contain characters from 'U', 'D', 'L', 'R'.


test2022_11_03_HL_newPosition(5, 7, "UUDLUDDR") → "(5,7)"
test2022_11_03_HL_newPosition(3, 1, "UUUUUUU") → "(3,8)"
test2022_11_03_HL_newPosition(-5, -2, "U") → "(-5,-1)"

...Save, Compile, Run (ctrl-enter)

public String test2022_11_03_HL_newPosition(int x, int y, String moves) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 250

Copyright Nick Parlante 2017 - privacy