Project 10, Program Design Solution

$35.00 $29.00

(60 points) Modify Project 9 dogs.c program so that the program is split into three source files and two header files. Put all functions related to operations on the list of dogs into dogs.c Create a header file named dogs.h that contains struct dog declaration and prototypes for the functions in dogs.c. The header file…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)
  1. (60 points) Modify Project 9 dogs.c 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 dogs into dogs.c

      1. Create a header file named dogs.h that contains struct dog declaration and prototypes for the functions in dogs.c. The header file should enclose the contents of the header file in an #ifndef-#endif pair to protect the file.

      1. Put the read_line function is in a separate file named readline.c.

      1. 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.

      1. records.c contains the main function.

      1. Include appropriate header files in the source files.

  1. (40 points) Write a makefile to build the part 1 program on student cluster. The makefile should contain the following rules:

    1. Build readline.o by compiling readline.c

    2. Build dogs.o by compiling dogs.c

    3. Build records.o by compiling records.c

    4. Build records by linking readline.o, dogs.o, and records.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 records.

Before you submit:

  1. (part 1) Compile with the following command and test with try_dogs gcc –Wall dogs.c readline.c records.c

  1. (part 2) Be sure your makefile contains the information necessary to build the dogs program. Test your makefile:

make records

./records

  1. Submit dogs.c, dogs.h, readline.c, readline.h, records.c for part 1 and makefile for part 2.

Grading

Total points: 100

  1. A program that does not compile will result in a zero.

  2. Runtime error and compilation warning 5%

  1. Commenting and style 15%

  2. 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.

  1. 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.

  1. 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)

  1. 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.

  1. Use consistent indentation to emphasize block structure.

  1. Full line comments inside function bodies should conform to the indentation of the code where they appear.

  1. Macro definitions (#define) should be used for defining symbolic names for numeric constants. For example: #define PI 3.141592

  1. Use names of moderate length for variables. Most names should be between 2 and 12 letters long.

  1. Use underscores to make compound names easier to read: tot_vol or total_volumn is clearer than totalvolumn.

Project 10, Program Design Solution
$35.00 $29.00