# Homework 2: Some Web Services

Summary: In this assignment, you will have the opportunity to develop two simple Web services in Scheme.

Assigned: Friday, 21 February 2003

Due: Monday, 3 March 2003

Evaluation: My primary grading emphasis will be on your use of higher-order procedures. I hope that you will be able to use the standard higher-order procedures to avoid any direct recursion.

Turning it in: Email me the MathLAN address of all the files needed for your assignment.

Collaboration: You may work in groups of up to size three. You may discuss the assignment with anyone you wish.

Citations: The Bizz-Buzz problem is based on a problem that Ben Gum wrote for CSC151. On 18 February 2003, it was available as Exercise 9 of `http://www.math.grinnell.edu/~gum/courses/151/labs/recursion-with-integers.xhtml`.

Useful Files:

Contents:

## Service One: Bizz Buzz

In the summer of 2002, I drove a group of ten-or-so Grinnell students to Denver. In the long-seeming trip, they shared as many silly word games as they could come up with. One such game was Bizz Buzz Here's my understanding of the game.

1. You pick a single-digit number, which we'll call the buzzer.
2. You start counting.
3. Whenever you hit a number that ends with the digit, you say bizz instead of that number.
4. Whenever you hit a number that is evenly divisible by the single-digit number, you say buzz instead of that number.
5. Whenever you hit a number this ends with the digit and is evenly divisible by the single-digit number, you say bizz buzz instead of that number.

### An Example

For example, if the buzzer were 3, the sequence would be: 1, 2, bizz buzz, 4, 5, buzz, 7, 8, buzz, 10, 11, buzz, bizz, 14, buzz, 16, 17, buzz, 19, 20, buzz, 22, bizz, buzz, 25, 26, buzz, 28, 29, buzz, 31, 32, bizz buzz, ....

### One Implementation Strategy

One strategy for putting Bizz Buzz on the Web is to write a page that prints out the Bizz-Buzz sequence starting with some number and ending with some number. In this case, the primary input page will need to take three inputs: the buzzer, the starting value, and the ending value.

You can visit an example of this strategy (which fails to actually report on the steps in Bizz Buzz).

### Another Implementation Strategy

Another strategy for putting Bizz Buzz on the Web is to write a script that does one value each time it is loaded, and moves on to the next value when it is loaded again (and again and again and ...).

You can visit an example of this strategy (which once again fails to actually report on the steps in Bizz Buzz).

### The Assignment

Pick one of the two implementation strategies. Make copies of the appropriate files. Update them so that they correctly play Bizz-Buzz.

### Extra Credit

1. Extend Bizz-Buzz in some interesting way.

One example is Bizz-Buzz-Fizz-Fuzz, a game very much like Bizz-Buzz except that it has a fuzzer as well as a buzzer. When the current number is a multiple of the fuzzer, you say Fizz. When the current number ends with the fuzzer, you say Fuzz. You can figure out the rest.

2. Combine the two implementation strategies.

3. Make it look nicer. (This will only earn you a little extra credit, but might give you a lot of satisfaction.)

4. Come up with something else on your own.

## Service Two: Book Selection for Nile.com

Nile.com is a new competitor for a well-known online book store. They'd like their Web site to include a book recommendation service. Unfortunately, they don't know many good programmers. However, they're fairly clever enough to realize that they might convince a naive professor (that's me) to assign their service to his students.

I'm so naive that I've even started the interface, which you can find at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/Examples/nile-dot-com.html`, and the corresponding Scheme script, which you can find at. `http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/Examples/nile-dot-com.ss`. I do want you to write something, so I've left the `select-book` procedure with an incredibly stupid definition.

It is your responsibility to finish the `select-book` procedure. Your procedure should step through the list of books, evaluating each in turn. It should return the best match for the reader's selections. What's the best match? The one with the most adjectives in the list of likes and the fewest in the list of dislikes. You get to decide how to combine those two factors.

### Extra Credit

1. Make the service more useful (e.g., by returning a set of top matches, rather than a single top match).

2. Allow a greater range of choices (e.g., by allowing the user to rank each attribute on a scale of 1 to 5). Note that just adding a few more adjectives does not count.

3. Make it look nicer. (This will only earn you a little extra credit, but might give you a lot of satisfaction.)

4. Find some other way to extend the service.

## History

Wednesday, 19 February 2003 [Samuel A. Rebelsky]

• Designed.
• Began to write.

Thursday, 20 February 2003 [Samuel A. Rebelsky]

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Tue May 6 09:19:38 2003.
The source to the document was last modified on Tue Feb 25 10:05:11 2003.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/2003S/Homework/hw.02.html`.

You may wish to validate this document's HTML ; ; Check with Bobby

Samuel A. Rebelsky, rebelsky@grinnell.edu