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

 

quiz2024_10_03_APP1SLHL_mashUp


Write a method that has two string parameters 'first' and 'last'. As a precondition, you may assume that 'last' will be AT LEAST as long as 'first' and could be even longer. Your goal is to return a string that combines all of the characters from 'first' with an equal length of characters from 'last'. For example, if 'first' was "testing" and 'last' was "on the computer" you would return "testingon the ". This is because 'testing' contains 7 characters, so you must use the first 7 characters from "on the computer". Look at the test data for more examples.


quiz2024_10_03_APP1SLHL_mashUp("", "askldfjwe") → ""
quiz2024_10_03_APP1SLHL_mashUp("X", "wxyz") → "Xw"
quiz2024_10_03_APP1SLHL_mashUp("testing", "on the computer") → "testingon the "

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

public String quiz2024_10_03_APP1SLHL_mashUp(String first, String last) { }

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