Posted: Mon Oct 19

Due: Tuesday 10/20 10:00am

Submission name: w13_strings

CodingBat Basics

  • If you go to https://codingbat.com/home/konstans@stuy.edu/apcs1 you will find a number of java problems that can all be solved with a single function. The problems are separated by topic.
  • When you click on a problem, you can write code in the provided text box and then run it. CodingBat will then run it against test cases. You will see the results immediately.
  • You do not need to create an account to use this site.

String exercises

For this assignment, write functions for the 4 problems under String 1 (makeOurWord, extraEnd, firstTwo, withoutX). As you complete them, collect your functions in a processing program. In your setup, call each function at least once and print out the results. For example:

void setup() {

  String p0 = makeOutWord("[[]]", "ahoy there");
  println("problem 0:\n" + p0);

  String p1 = extraEnd("Hello");
  println("\nproblem 1:\n" + p1);

}//setup


public String makeOutWord(String out, String word) {
 /* to be completed */
}//makeOutWord (problem 0)

public String extraEnd(String str) {
  /* to be completed */
}//extraEnd (problem 1)