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

 

test2023_09_08_P1SLHL_mashUp


Write a method that "mashes up" two strings by using the first 'num1' characters out of 'str1' followed by the first 'num2' characters in 'str2'. However, if either of the numbers ('num1' or 'num2') is greater than the number of characters in their respective strings, just use that whole string. NOTE: You may assume that 'num1' and 'num2' Look at the test data for examples.


test2023_09_08_P1SLHL_mashUp("You are not my...", 2, "dad", 2) → "Yoda"
test2023_09_08_P1SLHL_mashUp("I think that was something to do with", 2, "Luke and Vader", 4) → "I Luke"
test2023_09_08_P1SLHL_mashUp("$^*##@", 1, "What???", 1) → "$W"

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

public String test2023_09_08_P1SLHL_mashUp(String str1, int num1, String str2, int num2) { }

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

Copyright Nick Parlante 2017 - privacy