cmkl/fall-2025/sen-103/Labs/Lab2/Instructions.txt

32 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

In this lab exercise, you will break up your single-source program matrilineal.c into three source modules which have lower coupling and better cohesion.
Instructions
Start with your program from SEN-107 (Data Structures) Lab 3, the mother-daughter tree.
If you have not yet done this lab, you can start from scratch. The instructions for SEN-107 Lab 3 explain in detail what this program should do.
Create a new program that includes three C source files and two header files:
matrilineal.c This will hold the main function and the top level menu only. It will call functions in the other source files (probably just operations.c).
tree.c This will hold the tree data structure, with functions for manipulating that tree. For instance, you might have a function for adding a node to the tree, a function for finding a node in the tree, and so on.
tree.h This header file should include declarations for any functions in tree.c that will be called from other modules. If you need to define any structure types that will be shared with other modules, put those definitions in this header file as well. If you have “private” functions in tree.c which are not used in any other module, do not include them in tree.h.
operations.c This file will hold the functions that get input data for each operation, call the tree functions, and print results. This module should #include tree.h.
operations.h This header file should include definitions of any functions that will be called by matrilineal.c. It should be #included in matrilineal.c.
Write and test the code for each of these modules, then put them together. The result should be the same as for the original, single-source version of SEN-107 Lab 3.
If you prefer, you may do this lab assignment using Python. You should create three Python scripts: matrilineal.py, operations.py and tree.py.
To submit this lab exercise, create and upload a Zip file called Lab2.zip that contains all your source files (.c and .h, or .py).