CSC 160 Spring 2015 - Homework 12 (100 points)
Assigned May 4, Due MONDAY May 11

1) This assignment will NOT be accepted late for any reason, since solutions will be posted to Moodle Tuesday morning (5/12).
2) Assignments with time stamps during class time (Mon or Wed 4:15-5:30pm) will be given a grade of ZERO.
3) In the spirit of the pair programming article that you read and summarized in HW5, this week's homework assignment may be done in pairs. If you choose to work in pairs, you must find time outside of class to work together in person at one computer. As per the syllabus, you cannot "pair-off" with the same person more than once during the semester. If you choose to do the assignment in pairs, please submit one copy through Moodle where both last names are used in each file name and both names appear as a comment at the top of each pane (Definitions and Interactions).
4) Start this homework as soon as possible so that you have time to get any help you may need from the instructor or course tutor prior to when the assignment is due.
5) Do not start the exercises until to have fully read and fully understood the corresponding textbook sections. If there is something you do not fully understand, you must contact the instructor or course tutor prior to starting the assigned exercises.


[100 pts.] Chapter 21
Read Sections 21.1-21.5 of the textbook.

Do the following exercises in DrRacket (show all Design Recipe v2 steps whenever you Design a Function):
  • Exercise 21.3.5: Define a data type to represent a basketball player, including the player's name, what team (s)he plays for, and his/her jersey number.
    --For full credit, you must submit all four steps of the Design Recipe for Defining Structs.

  • Exercise 21.4.6: Develop a function same-team? which takes in two basketball-player structs and tells whether they play for the same team.

  • Exercise 21.4.7: Develop a function full-name which takes in a person struct and returns a single string containing the person's first and last names, separated by a space.
    --Note: For this function to work, you must type in the structure definition for person, as written in the Chapter 21 PowerPoint slides.
    --Note: For full credit, you cannot put spaces into the names in your examples. Instead, you must have the space added between the names in the function body.

  • Exercise 21.5.2: Develop a function change-jersey which takes in a basketball player struct and a (jersey) number and produces a basketball player with the same name and team as before, but the specified jersey number.



  • GRADING
    21.3.5/10
    Contract/Purpose Examples Skeleton w/Inventory
    and Added Details
    Definition
    21.4.6 /3 /6 /6 /15
    21.4.7 /3 /6 /6 /15
    21.5.2 /3 /6 /6 /15



    Last Modified: 4/22/15