Homework 1 function prototypes from sequence diagrams; include files solved




The objective is to give you practice on preparing a project, with
include files, in your IDE, so that it can compile and run.
The context of this problem is given by a sequence diagram. See Figure 1.
• See Figure 1. Figure out which functions are directly implied by this sequence diagram. (You may also include indirectly implied functions if you
wish.) Create a function prototype for each such function. Prepare one
or more include file(s) (.h file(s)), that contains these function prototypes.
Incorporate your include file(s) into the starter code for this homework.
This has two parts. The include file(s) should be found in the collection
of files making up the code (see Figure 2), and the include file(s) should
be used by the code (See Figure 3). Name one of your include files YourName.h. Though the figure shows one place for incorporating the include
file, that place might not be the best location. Choose the best location
within your code.
• Take a screen shot of your include file(s), showing the text, and also your
name in a comment. Incorporate that screen shot in your homework file
you submit for grading.
• Build the code, which should include the furnished starter code and your
include file(s), and take a screenshot of the results of the build. See Figure
3 at the bottom of the figure, where it says “Let’s do HW1”.
Things to do:
1. Either:
(a) Make a C project from the Hello,World project.
(b) Populate that project with tests.c, tests.h, production.c and production .h.
or use the starter code.
2. Create one or preferably more #include .h file(s) and incorporate it/them
in a reasonable location in one or more .c files.
Figure 1: A sequence diagram
Figure 2: Show the named include file in your project. Notice the highlighted
Figure 3: Show how your code incorporates that .h file. Notice the highlighted
text line.
3. Place each function prototype from the sequence diagram (also those you
chose to invent) into one of the .h file(s).
Criteria Possible Points
Project that looks like starter code 25
Existence in that project of the .h file(s) 10
Utilization of the .h file(s) in a reasonable .c file 10
Function prototypes correctly specified 25
Function prototypes include those inferred directly from sequence diagram. 30
Total 100