Assignment #2

String Stuff

Computers are good at doing boring repetitive work!

Since computers are really fast and fantastic at doing simple calculations, we are going to let it do that.

Here is the problem

Pick one (1) of the following "functions" and write the code (no using any build in function that does it) to actually perform it

  1. String blowup(String str)

Returns a version of the original string as follows: each digit 0-9 that appears in the original string is replaced by that many occurrences of the character to the right of the digit. So the string "a3tx2z" yields "atttxzz", and "12x" yields "2xx". A digit not followed by a character (i.e. at the end of the string) is replaced by nothing.

  1. int maxRun(String str)

Given a string, returns the length of the largest run in the string. A "run" is a series of zero or more adjacent characters that are the same. So the max run of "xxyyyz" is 3, and the max run of "xyz" is 1.

  1. Some other string manipulation that you would like to do, that is approved by me in advanced.

  2. Watch this video and implement the algorithm as a function (pass in the date, return the day)

  3. Write a function where the user enters in a whole number and then it returns an array of all the whole numbers IN ALPHABETICAL ORDER.

Things to note

  • If you are not sure on any part of the problem, just ask me and I will give you additional information

  • You must do the program in your primary language first (get a 3+). You can get a 4+ by doing the program in your secondary language

  • Remember to think, Input – Process – Output, when designing your program