Note: Future labs can change
1. Introduction
Introduction
- Slides: Introduction
- Slides: Hello
- Slides: Conditionals
- Pretest example
2. Conditionals
Conditionals
Homework:
- Task 1: Go through the Getting started
- Task 2: Algorithm in UML and C program code: employee wage calculation
- User is asked for the start and end times of work
- User is asked for number of days worked during a month
- User is asked for the hourly wage
- Calculate and print how much would the employee makes in a day and for the whole month
- Print if this is above, below or equal to Estonian average gross income. Use the number for the most recent published monthly wage. (e.g. june 2021)
https://www.stat.ee/en/find-statistics/statistics-theme/work-life/wages-and-salaries-and-labour-costs/average-monthly-gross-wages-and-salaries - E.g.
- Start 9, end 16, hourly wage 11, days in a month 21.
- Results: Daily income 77, monthly income 1617.
- This is higher than the average gross income in Estonia!
- Assistance: Introduction to algorithms and UML
In class:
- Slides: Conditional statements 2
3. Loops
Loops
Homework:
- Expand and improve the food scale program
- Menu has to have 2 levels
- First level chooses the product category (e.g. vegetables, fruits, …). Have at least 3 categories!
- Second level chooses the product from that category. Each category has to have at least 3 products!
- Show error messages for invalid input! Must support the following:
- No product on scale / negative weight
- Unknown category / category does not exist
- Unknown product / product does not exist
- Menu has to have 2 levels
In class:
- Slides: Preprocessor and compilation
- Slides: Loops
4. Functions
Functions
Homework: Create a UML diagram that matches your week 3 lab task 2 behavior (cash register with loops).
- Emphasis on correct modelling of loops
- Code and UML must be logically identical, including order of operations
- Turn extra attention to modelling the loop logic correctly – initialization, condition, loop body etc.
- Reminder: You need to state your intent rather than copy-paste the expressions from the code!
In class:
- Padding and alignment
- Slides: Functions
5. Arrays
Arrays
Homework: Finish lab tasks that are not yet submitted.
In class:
- Math.h library introduction
- Slides: Arrays
6. Arrays continued
Arrays continued
Homework: Write a program based on the task description: Age classifier
In class:
- Lab tasks are given under the extended lab description!
7. Sorting
Sorting
Home task:
- Take the provided code here: post.c
- The code is based on Algorithm 5: package ratios.
- Translate the algorithm from the code to UML in its entirety.
- Each statement must have a worded out explanation what is being done or checked! Copy-pasting statements from code is considered is not sufficient (e.g. having an action just be minInd = i does not explain what is being done!)
- Details such as how many places after the comma to display or where to put a newline are not shown in the algorithm!
In class:
- Slides: Numerical systems
- Slides: Sorting
8. Standard streams and pseudorandom numbers
Standard streams and pseudorandom numbers
Homework: No more weekly homework!
In class:
- Slides: pseudo-random numbers
- Slides: Standard streams
- Reading: stream redirection guide
9. Matrices
10. Menu program
Menu program
- Lab task and information is detailed under the lab’s extended description
11. TEST
TEST
12. Linux CLI
13. Strings
14. Command line arguments
15. Files
16. Examination
No normal lab on this week.
During this class, it’s possible to
- Write the exam. You need to register to attend for it. Read more: exam.
- Write a re-test for the test.