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

 

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

Sharks swim fasta (faster) every time they eat pasta. For each occurrence of "pasta" (exact spelling and capitalization) in the string 'txt', the shark will swim one time faster. Return how many times faster the shark will swim based on the contents of 'txt'. The only string methods you are allowed to use are: .length, .equals, .substring, .charAt, and .compareTo


oct31_2019_APP1SLHL_killerShark("Eat pasta!") → 1
oct31_2019_APP1SLHL_killerShark("Purple people profoundly prefer pasta, primarily") → 1
oct31_2019_APP1SLHL_killerShark("A dinner of pasta, pasta, and more pasta might just be too much pasta.") → 4

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

public int oct31_2019_APP1SLHL_killerShark(String txt) { }

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

Copyright Nick Parlante 2017 - privacy