FHTW Berlin Medieninformatik

FHTW Berlin
Fachbereich 4
Internationaler Studiengang
Internationale Medieninformatik (Bachelor)
Info 2: Informatik II
Winter Term 2008/09


Exercise 1 : String Transformers

Pre-lab: Read Lynn Stein's chapter on String Transformers.

Work in groups of two!

  1. We are going to program something from scratch. A string transformer is a method that takes a String as a parameter, does something interesting with it, and returns a new string that has the transformation applied. Set up either an Applet or a class that gets called from a Main class that offers at least 4 different methods for transforming strings. One could turn the string around front-to-back, one might put a space in between each letter of the string, a third might shift each letter down one.
  2. Remember the java.awt.* from last semester? What do you need to get a GUI going? Set up a simple GUI that reads a String from a TextField, and then applies a transformation to the String and outputs the results.
  3. Can you set up Buttons, one for each transformation, and have the transformation happen when you click on the button? You might want to look up some of the ActionListener stuff from last semester. What package was this in?
  4. (For the bored) Okay, you still have half the exercise time left. Make a transformation that transforms the strings into Pig-Latin. Remember that if the word starts with a vowel, it stays put and -way is added to the end.

Your report is due by 11.55 pm the evening before your next lab! As in Informatik 1, I am more interested in process than in product, although we are now getting more interested in products as well. Your report should include any collaborators, summarize what you learned, and note the time you invested in this exercise.

 


Copyright 2008 Prof. Dr. Debora Weber-Wulff
All rights reserved.
Questions or comments: <weberwu@fhtw-berlin.de>
Copyright and Warranty