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

 

srp4379@lausd.net > inOrder
prev  |  next  |  chance

String inOrder(String str1, String str2, String str3): Given 3 input strings, return a single string with the 3 input strings in alphabetical order separated by commas. HINT 1: See the compareTo and compareToIgnoreCase methods in the Help section (Strings). Read the documentation carefully. str1.compareTo(str2) returns zero if the two strings are equal, a negative number (NOT -1) if str1 precedes str2 alphabetically, and a positive number (NOT +1) if str1 follows str2 alphabetically. HINT 2: You know how to swap two values to put them in the proper order. Here you have to figure out how to swap three values. RUBRIC: It is not enough to just solve the problem. Make sure you use PROPER INDENTATION. You MUST use CURLY BRACKETS for all loops and if/else statements. Also, the more EFFICIENT your solution, the higher your grade. If you have extraneous (superfluous / unnecessary) code, deductions will be taken.


inOrder("shalom", "kamusta", "hola") → "hola,kamusta,shalom"
inOrder("xyz", "mno", "abc") → "abc,mno,xyz"
inOrder("april", "MAY", "September") → "april,MAY,September"

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

String inOrder(String str1, String str2, String str3) { }

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

Copyright Nick Parlante 2017 - privacy