about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 280
Copyright Nick Parlante 2017 - privacy