Homework I

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

This is a part of your final grade!

The task

The task is given during the lab on the 3rd week. If You were missing, come and find us to get yours.

You must create your own data file for the program to use. It should contain at least 10 entries

Documentation [sample]

  • Title page
  • Declaration of originality
  • Table of contents
  • The task given
  • Detailed description of the program (approx. 1 – 3 pages). A proper structure must be present – subheadings, tables, numeric / bullet lists etc. Walls of text will lose points.
    • What’s the purpose of your program
    • In what order are things done?
    • Document your functions
      • Name of the function
      • What’s the purpose of the function? What does it do?
      • What data does the function need? (parameters – name, datatype, semantics)
      • Are there any requirements for the parameters? (preconditions)
      • What do they return? (data type, semantics)
    • Document your structures – the purpose of each structure, data types and semantics of each member
    • How are special cases handled/solved (e.g. possible errors and other issues that may happen)
  • Screen capture(s) of the program
  • Document the input file structure
    • How are data fields separated?
    • Detail the data fields – data type and meaning (semantics)
    • Present a single data row from the file as an example

Before submission checklist (requirements)

  • Documentation is well structured and corresponds to the requirements set before.
  • Each data file has at least 10 entries.
  • If a data line is removed or added (as per specification described in the documentation), the program should still work correctly. No need for dynamic memory in this homework, just avoid crashing when data file is longer than the struct array and work properly if some of the lines are deleted.
  • The data is read into structures (and substructures). You can add additional fields to the structure and create additional structures if it makes sense to do so.
  • There’s basic error handling. When you are exiting the program due to an error, state the reason why!
  • The code is divided between meaningful functions (at least 2 besides main).
    If you’ve written a snippet of code with the same purpose twice, you should think about creating a function for that as well.
  • Data must be passed to the functions using parameters only.  You are not allowed to use global variables!
  • Function prototypes before main, their contents after main.
  • Coding style requirements are met, including
    • The code is properly indented, whitespace and newlines are used where needed
    • Naming of your variables, functions, macros etc is self-explanatory and consistent
    • No magical numbers
    • No global variables
    • No GOTO statements
    • Only required libraries are included
    • Files have headers
    • Code is commented.
    • etc
  • If you have searches in your program and they didn’t come up with any results, you should give the user feedback that nothing was found. This is also the case for empty input files.

You can always come and ask us if we think your work meets our requirements.


Homework code sample


The first homework is valued at 15p.

To get 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 08.03.2020

Every week after the deadline removes 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.

We will only accept Your homework until the end of the contact learning period (15.05.2020). Past that, submitting your homework will not be possible.

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.

Bonus points / advanced

It is possible to earn 2 bonus points from the task. The bonus points will be included in the grade calculation.

Late weeks don’t apply for solutions that fulfill the bonus points requirements.

To get the bonus points, the following requirements must also be met in addition to the basic ones:

  • Error-proofing
  • Good structure / optimal code / optimal algorithms
  • Well written documentation
  • Must handle input file tampering / corruption.
    • Wrong data types (text or decimal instead of an integer etc.)
    • Data out of range for the task (e.g. temperature below 0 kelvin)
    • Overflows (e.g. expects name up to 30 characters, will give 100)
    • Missing or extra fields
  • String normalization (tAlLiNn -> Tallinn, COOKIES -> cookies)

Submitting Your work

Files required:
  • Documentation (pdf)
  • All of the code files
  • Data files required to run the program
  • If you have more than one code file or use any other standard than C90, include a makefile for linux

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: HW1_<firstname>_<lastname>_<studentcode>



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

Feedback and results

Once the homework is graded, your score will be visible on Moodle. If the score wasn’t the possible maximum, there will be a comment that will describe what the points were lost for. This may also be present even in the case of full points.

Any homework that receives 0 points needs to be defended.