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

 

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

Write a method that returns all the characters in an all lower-case string until the first character that is NOT in increasing alphabetical order. For example, if the input parameter is "abscond", you would return "abs" because a, b, and s are in increasing alphabetical order, but the "c" that follows the "s" is not in increasing alphabetical order, so that letter and everything after it are ignored. As a precondition, you may assume that the input parameter string will have at least one character and will contain only lower-case letters. The only string methods you are allowed to use are .length, .charAt, .substring, and .equals. You MUST use a while loop (because you need practice using while loops and also because it is the best loop to use in this case)


charsIncreasing("ebbert") → "e"
charsIncreasing("almost") → "almost"
charsIncreasing("abhors") → "abhors"

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

public String charsIncreasing(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