Project 11, Program Design



Project 11, Program Design
1. (60 points) Modify Project 10 roster program so that the program is split into three
source files and two header files.
1) Put all functions related to operations on the list of players into
2) Create a header file named player.h that contains struct player
declaration and prototypes for the functions in player.c. The header
file should enclose the contents of the header file in an #ifndef-
#endif pair to protect the file.
3) Put the read_line function is in a separate file named readline.c.
4) Create a header file named readline.h that contains a prototype for the
read_line function. The header file should enclose the contents of the
header file in an #ifndef-#endif pair to protect the file.
5) roster.c contains the main function.
6) Include appropriate header files in the source files.
2. (40 points) Write a makefile to build the roster program on circe. The makefile should
contain the following rules:
1) Build readline.o by compiling readline.c
2) Build player.o by compiling player.c
3) Build roster.o by compiling roster.c
4) Build roster by linking readline.o, player.o, and roster.o
Each rule should include the name of the target file, dependencies among files, and the
command to be executed. The makefile should name the executable file for the program
Before you submit:
1. (part 1) Compile with the following command and test with try_roster
gcc –Wall player.c readline.c roster.c

2. (part 2) Be sure your makefile contains the information necessary to build the
roster program. Test your makefile:
make roster
3. Submit player.c, player.h, readline.c, readline.h,
roster.c for part 1 and makefile for part 2.
Total points: 100
1. A program that does not compile will result in a zero.
2. Runtime error and compilation warning 5%
3. Commenting and style 15%
4. Functionality 80%:
Part 1: Program divided into appropriate source files and header files.
Part 1: Source files include appropriate header files
Part 1: Header files protected using ifndef-endif
Part 2: makefile implemented the way specified
Programming Style Guidelines
The major purpose of programming style guidelines is to make programs easy to read and
understand. Good programming style helps make it possible for a person knowledgeable
in the application area to quickly read a program and understand how it works.
1. Your program should begin with a comment that briefly summarizes what it does.
This comment should also include your name.
2. In most cases, a function should have a brief comment above its definition
describing what it does. Other than that, comments should be written only needed
in order for a reader to understand what is happening.
3. Information to include in the comment for a function: name of the function,
purpose of the function, meaning of each parameter, description of return value (if
any), description of side effects (if any, such as modifying external variables)
4. Variable names and function names should be sufficiently descriptive that a
knowledgeable reader can easily understand what the variable means and what the
function does. If this is not possible, comments should be added to make the
meaning clear.
5. Use consistent indentation to emphasize block structure.
6. Full line comments inside function bodies should conform to the indentation of
the code where they appear.
7. Macro definitions (#define) should be used for defining symbolic names for
numeric constants. For example: #define PI 3.141592
8. Use names of moderate length for variables. Most names should be between 2
and 12 letters long.
9. Use underscores to make compound names easier to read: tot_vol or
total_volumn is clearer than totalvolumn.


There are no reviews yet.

Be the first to review “Project 11, Program Design”

Your email address will not be published.