This assignment is to be done individually. Hand it in
electronically (using submit ) before 4:00pm on
Monday, September 25, 2006.
For instructions, click
here. |
Important Note: Late assignments will not be accepted! |
Download the starter files for Assignment 1 which includes all the files you need for this assignment.
For this assignment, you will accept words from the keyboard and output the text as though spoken by the Swedish Chef from the Muppets.
For our purposes, a word is a sequence of characters that is surrounded by whitespace (spaces, returns, etc.). Note that a word does not include any punctuation at the end - this is dealt with in the translation rules. Unless noted in the rules, you do not have to deal with capital letters.
To transform a word from English to Swedish Chef, use the following rules (and note any hints or dependencies mentioned):
To help you with the interpretation of the rules, we have provided a Java applet that provides a sample translator implementing these rules. Your output should match the output produced by the applet. The applet can be launched by pressing the button on this page.
Note that you can implement this assignment using the String class, getting substrings and appending strings together. Another option is to use the StringBuffer class, which includes string manipulation methods that you may find useful. A third option is regular expressions, which can make this assignment easier if you already understand them. Be warned that you should only use regular expressions if you are already familiar with them since you may receive limited tutor and TA help. You can look on the Resources page for a link to Java documentation to get more details on some of the classes for the alternate implementations.
Your assignment should follow the style and documentation guidelines laid out in class and on the CS 133 web site.
A very important consideration in this assignment is testing. You will need to construct test cases that check each rule in isolation and also check for combinations of rules to be sure that you're applying all of the necessary rules at all matching places in a word and in the correct order. The latter test cases will require some planning.
Programming assignments must be submitted electronically. Be sure to include your name and ID number in every file you submit.
Submit the following files:
SwedishChef.java
There is a utility on this page to see what files you have submitted for an assignment. It is always a good idea to check that you have submitted everything. Click here to check your submissions.