Problems for Lesson 4

[TODO: Explain how to install the “Handin” button in DrRacket.]

The Handin button submits whatever is in DrRacket’s definitions area, so click Handin after you have defined image1, image2, and on-blue, all in the same program. The submission process will check that you have defined the right names and check your definitions.

Problem 4.1 – Define a Constant

Write a program that defines image1 to be a picture showing the number 17 raised to the 42nd power. The number should be in black text of size 12.

Don’t paste an image into your program. Instead, use the functions expt , number->string, and text to create the image.

Problem 4.2 – Define Another Constant

In addition to image1, define image2 to be like image1, but with a blue background.

Use the functions image-width, image-height, rectangle, and overlay to define image2 in terms of image1.

Problem 4.3 – Define a Function

Define the function on-blue that takes any image and places it on a blue background.

The process of defining image2 in terms of image1 should help you implement the function. Afterward, you could change the defintion of image2 to (define image2 (on-blue image1)), if you prefer.