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

 

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

Write a method that accepts two magnitudes for possible motion along a line. Return a string representing the possible ending locations, starting from zero, and either adding or subtracting each magnitude. The string must list the possible results in increasing order. For example, with magnitudes of 3 and 7, the returned string would be: "-10, -4, 4, 10". Please note that magnitudes are never negative, but could be zero. Also note that you should always return a string with four numbers, even if they are all the same in some cases.


dec9_2016_APSLHL_combineMagnitudes2(124, 145) → "-269, -21, 21, 269"
dec9_2016_APSLHL_combineMagnitudes2(9235, 422) → "-9657, -8813, 8813, 9657"
dec9_2016_APSLHL_combineMagnitudes2(235, 768) → "-1003, -533, 533, 1003"

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

public String dec9_2016_APSLHL_combineMagnitudes2(int a, int b) { }

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: 220

Copyright Nick Parlante 2017 - privacy