Homework I

Homework 1: Tabulating a function y=f(x)

For homework I, you will have to create a software solution, that will solve a mathematical function y = f(x) within the limitations specified. The results must be displayed as a table with columns for X and Y values. Some hints about aligning it can be found from printf tips example.

Argument (xi) Function value yi=f(xi)
x1 y1
x2 y2
xn yn

The formulas for both xand yi are provided by your personal variant.

Function value should only be shown if the value exists. If the value cannot be calculated for the given x or is a complex number, You can choose to display “missing” or “complex”. If you wish, you are free to calculate the imaginary numbers and display them as well. Regardless of the variant, you will need to find up to 20 results.

The inputs for the program come from the keyboard and are entered by the user. All inputs besides the number of steps N must support real numbers. Number of steps N is an integer.

You will need to create and submit a program written in C, an algorithm for the program represented as an UML activity diagram and a report.

Homework variant

Report

You will have to write a detailed report on the solution you made. The report must be well structured and detailed. The quality of the report is a part of the grade.

The report must adhere to IT faculty’s thesis guidelines. Most faculties use the same or similar principles with minor alterations. We are providing you a shortened (non-complete) version of this guide provided, that you should follow: https://blue.pri.ee/ttu/resources/report-guidelines/

To make this easier for you, we are also providing a template that contains the necessary predefined styles and is adjusted to the requirements of the first homework.

Adjusted report template

Download the template: https://blue.pri.ee/ttu/files/iax0583/mallid/mall_2025_en.dotx

Each section of the template contains comments written in blue text about the expected content. Use these blue texts to guide you. Once the report is finished, delete the blue text before submitting.

You are allowed to change the structure of the template as needed. E.g. you may need to add a subheadings or headings, depending on your work structure.

Make sure to read the documentation writing guide provided under the resources!

Generic template (LaTeX)

The official university LaTeX templates are available on  https://www.overleaf.com/latex/templates/tagged/taltech. Since this is a generic template, please look through the adjusted homework template to make sure that all required parts are covered.

Generic template (MS Word, OpenOffice)

If you wish to use a generic template and adjust it from scratch, you can find them here: https://taltech.ee/en/thesis-and-graduation-it#p43359

NB! When using a generic template, please look through the adjusted template to make sure that all required parts are covered.

Documentation contents

In your first homework, use the the template as a guide to structure your written work!

Your report should contain the following sections

  • Title page
  • Declaration of originality
  • List of abbreviations and terms (can be omitted, if none exist)
  • Table of contents
  • List of figures and tables (can be omitted, if none exist)
  • Task description and variant
  • Mathematical function y=f(x) analysis
    • Describe the function, perform a function analysis
    • Function plot
      Possible tools to create it [google], [wolfram alphat], Microsoft Excel, etc.
  • Description of the solution
    • A write up on the solution. Use the key points brought out in the template for guidance! The length of the written part must be between 1 – 2 A4 pages, not including figures. The description must be well structured
    • Program workflow
    • Algorithm, modeled as UML activity diagram
  • Summary
    • A few sentences about your approach to the task and work processes.
    • A few sentences about the task itself and the complexity of it
    • If possible, give an estimate on the workload
    • Would you recommend reusing the task? Would you change anything about it, and if so, what?
    • Additional comments, emotions, thoughts
  • References (can be omitted, if none exist)
  • Screen capture(s) of the working program
    • Screen captures should illustrate various situations that you program can handle, as well as the normal behavior.
    • Screenshots can be added as an appendix or embedded within the write up of the solution – in this case you can extend the length by the amount of figures.

Note: If you used concepts and techniques that were not covered in the programming course by the time of writing this homework, you must explain the principles and benefits the code. You are allowed to go beyond the limits when describing this.

Common issues in reports

This is a list of commonly made mistakes that we see

  • The title page is inaccurate.  The top two or three lines of the title page indicate to whom you are submitting your report to
  • Wrong calendar year in the bottom of title page
  • The predefined styles in the template are not used for formatting body text, headings etc
  • Blank pages are left in the report
  • A title cannot be directly followed by either a subtitle, figure or a table. It must contain at least one full paragraph of text directly following the title
  • A title cannot only contain a figure or a table. It must contain text that explains it
  • Tables and figures must have a caption
  • Tables and figures need to be cross-referenced in the text
  • The written text must not be a large monolithic blob – you must structure your written text (paragraphs, titles and subtitles, tables, figures, lists Etc.)
  • Algorithm must be print-ready – if your report is printed on A4 paper, it must be readable
  • Your report can only include short snippets of the code and only when it is necessary to illustrate a part of the description Report must not contain your entire program code
  • Screenshots should only be of your application running, not contain your entire desktop or code editor
  • Appendixes must be referenced in text
  • Report cannot contain examples from the template that are not used in the work itself or the blue guidance text

Requirements for the standards and environment

The program must be written in the C programming language. You are permitted to use the C90 and C99 standards. Using newer standards (C11, C17, C23) is permitted, if it provides additional value. This must be explained in the report.

In addition to the standard C libraries, you are allowed to use C POSIX and GNU C libraries and extensions. Any other libraries must be agreed upon separately.

Your program will be compiled and tested in a Linux environment, equivalent to the one in the lab computers (OpenSUSE SLED-15 SP5, using GCC-12) or the recommendation for home setup  (Ubuntu Linux 24.04, using GCC-13 compiler or later). Compatibility with Windows or MacOS is not required.

Requirements for the solution

Your code must adhere to the practices covered so far.

  • Must not use GOTO statements
  • Must not use global variables
  • Must not use variable length arrays (VLA – variable length array)
  • Must not have any unused components in the code (e.g. libraries, variables).
  • At maximum, the program should 20 results
  • All inputs (except for the step count) must support floating point values.
  • Code is divided into functions
    • Compose your functions based on the practices learned and follow the coding style requirements
    • No function should include spaghetti code – this also includes main() function
    • main() function must be the first function in your code file. All user defined functions should be after the main function
  • Code must adhere to the coding style, including (but not limited to):
    • Coding style is uniform throughout the file(s)
    • All code files have an appropriate header with the name of the author, date, short description
    • The code is commented
    • Variable names are self-explanatory
    • The code is indented, lines are within the maximum allowed length and spaces are put where required.
    • No magical numbers
Requirements for the algorithm

Generic requirements

  • Algorithm conforms to the UML activity diagram requirements
  • Algorithm is divided into swim lanes based on logical blocks
    NB! Algorithm should not specify or reference the user-defined functions!

Make sure not to have the following common mistakes

  • Each decision node specifies a condition
  • All of the possible exits (flows) from a decision node are marked (e.g. in what condition will the program follow each path – true/false, const values for switch cases Etc.)
  • All flows from a decision node must be viable – each flow must be logically reachable
  • If multiple paths merge (following a decision node), a merge node must be used
  • No dead ends – You have to have a way to the exit from all of the nodes, actions Etc.
  • No infinite loops – It must always be possible to exit them

Extra task for bonus points

It is possible to earn up to 15 bonus points from the task. In order to get any points, you must include the added features to the report. It is possible to obtain partial bonus points if not all requirements are met.

To get bonus points, the following requirements must also be met in addition to the base requirements

  • All X and Y values must be stored in arrays
    • Storing the results to the array(s) must be written in a separate function from where the results from the arrays are printed
  • In addition to allowing the user input for the values used for calculations, your program must have preconfigured (hardcoded into the source code) sets of values  which the user must be able to execute
    • User must be able to choose if they want to enter the values or use a preconfigured set of values
    • You must have at least 2 sets of preconfigured values that demonstrate your program in different situations
  • Program must be able to calculate multiple sets of results without exiting. User must have an option to close the program when desired.
  • You must add a level 1 heading to the documentation called “Extra task”.
    • Describe the added features
    • Describe the chosen input sets and why they were chosen

Deadlines

A complete homework must be submitted no later than 19.10.2025 23:59:59 (local time)

Each day passed the homework deadline will deduct 1 point from the final homework score. The late penalty is capped at 50 points, meaning if you submit 60 days late, you will still lose 50 points..

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 need to submit the documentation in Adobe PDF format and all the necessary code files to compile your program.

Naming schema: HW1_<lastname>_<studentcode>

Example:

HW1_Smith_123456MVEB_code.c
HW1_Smith_123456MVEB_report.pdf

Submitting is done using Moodle.

Result and feedback

After your work has been checked and graded, you will see the result and feedback on Moodle (visible from the course gradebook!). If everything was well done, feedback may be absent.

Fixing your homework

You are allowed to fix and improve your homework score until the date of homework lockdown. All fixed submissions are subject to defense.

To fix your homework, first go through your feedback. Then contact your teacher and agree upon the process of how this homework can be fixed.

NB! If fixing the homework changes more than half of the original homework, it is considered as submitting a completely new homework, from which minus points can be deducted from depending on the time of submission.