Homework II

RequirementsThe taskSample solution

For homework II, you have to compose a program and write a report on it.

Documentation [structure sample]

  • Title page
  • Declaration of originality
  • Table of contents
  • Details about the program (2 – 3 A4 pages)
    • What is the purpose of Your program? What does it do?
    • In what order are things done? The program flow.
    • Give details on your functions (for each function created):
      • Function description, side effects
      • Parameters and return value, including their data types and semantics. This may include the requirements for data (e.g. expects a positive integer).
    • How does the program get its input, which data types are used and/or accepted? In which order must the input come in?
    • Are there any special cases – e.g. situations where the program has to stop due to an error. How are they handled?
  • Screen capture(s) of the working program
  • List of references
    Anything you got off the internet or the books. Even the content you got from your friend or coursemate.

Before submission check that… (requirements)

  • All of the coding style requirements are met, including
    • Code is indented, all of the spaces and line changes are where they should be
    • Names of the functions, variables and preprocessor macros are self-explanatory, formatted correctly and have purpose
    • There are no magic numbers
    • The are no global variables
    • The declarations of variables are only in the beginning of functions
    • Files have headers
    • No unnecessary libraries are used
    • All of the functions are commented
  • At minimum, the functions specified in the task are implemented
  • The program must work with different input data (e.g. we may change the input values, but we wont change the types of the input). NB! We’ll be using stream redirection to test Your homework. Our test files will be based on the sample given to You.
  • Data must be passed to the functions using parameters only.  Returns and more advanced methods are allowed, global variables are not.
  • Function prototypes are before the main() function, function implementation is done after the main() function

Deadlines, points and bonuses

The second homework is valued at 15p.

To receive the highest possible score, You have to follow the coding style and complete the requirements given.

A complete homework must be submitted no later than 24.11.2019

Every week passed the deadline withdraws 1p from the maximum possible score. This countdown is halted at 10p, meaning if you submit 7 weeks late, you can still get up to 10p.

Submitting before deadline gives you the right to earn up to 2 bonus points.

  • Submitting before 15.11.2019 22:00 – 1p
  • Submitting before 20.11.2019 22:00 – 2p

To be eligible for the bonus points, all of the requirements must be met. Partial or buggy solutions will not get bonus points. If the submitted homework fails to fulfill the requirements, bonus points will be forfeit.

If we have questions about the submitted homework or are not sure about the original author of this work, we will grade this with 0p. In this case, the work must be defended.

If it becomes necessary, we will enforce the rules and guidelines of [Procedure for processing a student’s violation of academic practices and contemptible behavior in the School of Information Technologies]

We will only accept Your homework until the lockdown date (check introduction slides). Past that, submitting your homework will not be possible.

Submitting Your work

You only need to submit the documentation (*.pdf) and code file(s). If necessary, include a makefile and input files.

Submitting is electronic only. Follow the file naming convention or we might miss your work or mix it up with someone else’s!

Naming schema: HW2_<studentcode>_<firstname>_<lastname>


File names: HW2_123456MVEB_Heli_Kopter

Submitting is done using moodle: moodle.hitsa.ee/course/view.php?id=13128

NB! Reminder: You are not supposed to read the files in your program. The files are to be used by stream redirection!!!

NB! This is only a partial solution displaying some parts of the testing, code style and creating a title page. We expect a full report as described in the requirements.

To view the sample code, click here
For a little bit on testing the code, look here

To test this, I’m going to use multiple test files to check if my conditions work as expected.

Test 1:



Test 2:



Documentation structure sample