CSC 160 Fall 2008 Homework 12
Assigned Dec 8, Due MONDAY Dec 15
Reread Sections 16.1-16.6 of the textbook.
Do the following exercises:
Exercise 16.3.2: 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 16.5.5: Develop a function
same-team? which takes in two basketball-player
structs and tells whether they play for the same team.
Exercise 16.5.6: 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 structures, as
written in the Chapter 16 lecture 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 16.6.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 |
| 16.3.2 | /10 |
|
Contract |
Purpose |
Examples |
Skeleton |
Inventory |
Definition |
Testing |
16.5.5 |
/3 |
/2 |
/3 |
/3 |
/4 |
/12 |
/3 |
| 16.5.6 |
/3 |
/2 |
/3 |
/3 |
/4 |
/12 |
/3 |
| 16.6.2 |
/3 |
/2 |
/3 |
/3 |
/4 |
/12 |
/3 |
Last Modified: 11/28/08