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

 

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

Write a method that accepts 'pos' as a position in a string, with pos=1 representing the first character in the string (not the zeroth), and 'str' which is the string to consider. If 'pos' is past the end of the string, return -1 as an error code. Otherwise return how many characters remain in the string AFTER position 'pos'. As always, look at the test data for examples.


Sept13_2019_P1SLHL_remaining(20, "The most powerful Jedi we have ever seen on screen... is a Muppet!") → 46
Sept13_2019_P1SLHL_remaining(5, "run for the hills...") → 15
Sept13_2019_P1SLHL_remaining(2, "yes, base problems are funny for noobs to try!") → 44

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

public int Sept13_2019_P1SLHL_remaining(int pos, String str) { }

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

Copyright Nick Parlante 2017 - privacy