U.C. Berkeley Summer 2010, CS3L

Project 2- Number Name

Background

Goals

This project is to reinforce the concept of recursion, as well as testing for edge cases within a project.

Restrictions

In this project, you are forbidden to use the following: higher-order-functions, lambda as well as anything else not from the first 4 weeks of class.. Any previous code that you have written is fair game to use, as well as any code that was in the case studies.

This project can be done with a partner. If you work in pairs, only submit one copy of the code, but put both your names and logins inside the files.

Project Overview

In this project, you will be working to convert numbers into text. There is a general project overview that can be found in the book on page 233 or here. There is also a giant hint that you should follow.

Warnings

Be sure to use good variable/function names. Adding really short comments about what the function does helps you and other people understand the code. We will be looking for terrible style in this project, so be sure to make code clean and concise.

One large part of the project is dealing with 0's. Putting together 3 zeroes still becomes 0 the number. If you want to keep the three 0's together, you should enclose them in double parentheses. "000" will keep it as a word with 3 zeroes.

You will have to write some large conditional statements when you are translating numbers into words. This applies for the teen numbers, the 10's (20, 30, etc...) and the first 10 numbers itself. This will not cause you to lose points.

You will never have to use the word 'and' in this project. So when 104 is an input, the answer is (one hundred four) not (one hundred and four).

Testing is pivotal in this project. Again, you should test all non-trivial helper functions in addition to your main function. There are many edge cases that could potentially occur. It is a good idea to write the test cases first, before writing your code.

Due Date

This project is due one week from now, on July 22, 11:59 pm. You have 3 slip days total between all projects but use them wisely. To submit the project type "submit mp2" from unix. The filename should be called mp2.scm. Along with the file itself, you should include a test file, called mp2-tests.scm. This should be in the same format that you used in project 1 (using the add-test-case framework).