NOTE: Your file will be saved as yourLastName-hw0.rkt. DrRacket saves the work done in the Definitions window only.
As you answer each of the remaining problems, use comments in your file to clearly indicate the number of the problem you are solving, e.g..
;; ;; Problem 1 ;;
(* (+ 4 3) 9)You should provide the following comments in the Definitions window:
;; (* (+ 4 3) 9) ;; (* 7 9) ;; 63
(if (< (string-length (string-append "CS" "1101")) (* (- 8 5) (/ 30 15))) 36 (sqrt (+ (sqr 3) (- 11 4))))
(and (> (+ (double (+ 1 3)) 10) (+ 15 5)) (> (double (+ 2 3)) 4))where
double
is defined as
(define (double n) (* n 2))
rectangle
and text
) from the
image
library. Add the following line to the Definitions window:
(require 2htdp/image)Now click the Run button. The functions in the image library are now available to your program.
From the Help menu, choose Help Desk. A browser window will open.
Under the Teaching heading, choose How to Design ProgramsTeachpacks.
In the left margin, click on HtDP/2e Teachpacks.
Here
you will find a description of all the pre-defined functions in the
image.ss
library. Notice the ...search manuals... box at the top of the page. Type in
image-width
to find information about that function. When the DrRacket Helpdesk provides the matches for image-width
, choose the one from "2htdp/image".
Develop a function called four-square that consumes an image and produces an image that consists of 4 copies of the original image, as shown in this example:
if the original image looks like this:
then the produced image should look like this:
Use the DrRacket help desk to learn about the following functions (available in the 2htdp/image library) that you might consider using for this problem:
Google images is a good repository for images. Use a square-shaped image when you try out your program. To copy an image, right-click on the image, select Copy, then in the DrRacket Definitions window, select Paste. You should use define to name any images you copy into your program.
Note: Make sure you provide a signature and purpose for your function. You do not have to test this problem with check-expect
.
event-cost
.
ticket-revenue
.
event-profit
.
check-expect
.
NOTE: You must name each function with the exact name specified in the problem.
Your signature must conform to the problem description. Otherwise, we won't be able to run our automated tester on your program, and you'll lose points. Programs that don't work with our auto-tester (and thus must be tested manually) will be penalized with a deduction of 10% of the total number of points for the assignment.
Using InstructAssist,
choose Tools -> File Submission
to
turn in the file (yourLastName-hw0.rkt) containing your Definitions Window content.
Your name and your wpi ccc username must be listed in a comment at the beginning of your file. Programs submitted after
5pm on Wednesday, August 31 will be considered late. No submissions will be
accepted after 5pm on Thursday, September 1.