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

 

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

Write a method that has three input parameters 'str', 'skip1', and 'skip2'. The 'str' parameter will contain any string. The 'skip1' and 'skip2' parameters will each be a different integer greater than 1. Return a new string based on 'str' but with every "skip" character skipped. For example, if 'str' is "Hello there!", 'skip1' is 3, and 'skip2' is 5 you would return "HelThe" because you would skip every 3rd character AND every 5th character from the original string. Note that 'str' could be any length and 'skip' can be any integer greater than 1. If 'skip' is greater than the length of 'str' you would just return the entire 'str' string, since no characters would be skipped. Restrictions: The ONLY String methods you are allowed to use are: .length, .substring, .charAt, .equals, .compareTo


test2024_11_21_APP1SLHL_skipLetters("You gotta cry without weeping Talk without speaking Scream without raising your voice", 5, 11) → "You ottary ithotwepingTakwithut eakig Sceam itho rasingyurvoic"
test2024_11_21_APP1SLHL_skipLetters("You gotta cry without weeping Talk without speaking Scream wihtout raisng you voice", 7, 13) → "You gota crwithou weeig Talkwitou speakngScram wihot rasng yovoice"
test2024_11_21_APP1SLHL_skipLetters("Hello There!", 3, 5) → "HelThe"

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

public String test2024_11_21_APP1SLHL_skipLetters(String str, int skip1, int skip2) { }

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

Copyright Nick Parlante 2017 - privacy