Assignment 5
Due Date Thurs 1/26 at 11:59pm
Possible Points 37
Purpose To start using the design recipe in code and get practice with big-bang.
Graded Exercises
This assignment and all future ones require adherence to the design recipe. Failure to do so will result in severe loss of points.
Data definitions and their interpretations
Examples for each data definition
A template for each data definition
A signature for each function
A purpose statement for each function
Testing for each function
; A FanFic is a (make-fanfic String String String String Nat) (define-struct fanfic [title author fandom body likes]) ; - where title is the title of the fanfic ; - author is the username of the author ; - fandom is the name of the fandom to which the fanfic belongs ; - body is the contents of the fanfic ; - likes is the number of likes it has received
Note: In your examples, it is fine to leave "" for the body. We are not scoring you on this part of the example, but feel free to have fun. Keep in mind the 102-character line limit and that the course staff will actually be reading these things.
Exercise 1 Design a function like that given a FanFic will increase its like count by 1.
Exercise 2 Design a function dislike that given a FanFic will decrease its like count by 1. Recall that a natural number must be at least 0.
Exercise 3 Design a function add-text that takes a FanFic and a String and returns a FanFic with that string added to the end of the text field.
Exercise 4 Design a simple game that will place a ball where people click on a screen. The ball will begin at the center of the screen, and when someone clicks the ball will appear in that point. Be sure to provide a data definition for your world.