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)
    • What’s the purpose of your program
    • In what order are things done?
    • Give details on your functions
      • What’s the purpose of the function? What does it do?
      • What data does the function need?
      • Are there any requirements for the data?
      • What do they return?
    • Describe your structures – the purpose of each structure, data types and meaning of each member
    • How are special cases handled/solved (e.g. possible errors and other issues that may happen)
  • Screen capture of the program
  • Input file structure (how are data fields separated? What data type and format?)

Before submission checklist (requirements)

  • Used data is read from a file, also stored if specified by the task. No more stream redirection.
  • Each of the data files has at least 10 entries!
  • 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 can’t 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.

Sample

Homework code sample

Deadlines

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 13.10.2019

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 (20.12.2019). 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
  • 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>

Example:

HW1_John_Smith_123456IASB.c
HW1_John_Smith_123456IASB.h
HW1_John_Smith_123456IASB.pdf
HW1_John_Smith_123456IASB_input1.txt
HW1_John_Smith_123456IASB_input2.txt

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