ConceptStep · learning platform for computer science

Final mini-project: temperature monitoring

C programming · Lesson

C · lesson 27 / 27

Final mini-project: temperature monitoring

Close the path by building and verifying a complete solution: data, loop, conditions, arrays, statistics, tests and a final decision.

1 · Observe and predict

The concept

The project uses five temperature readings. It reads a threshold, computes average, minimum and maximum, counts how many readings reach the threshold, and produces ALERT or OK. Solution quality is checked with multiple tests, not a single run.

Mental model:

specification → array → threshold → loop → statistics → ALERT/OK → tests: 22→5 ALERT | 30→2 ALERT | 35→1 ALERT | 36→0 OK

2 · Flowchart First

Follow the same algorithm as a flowchart

Use Start and Step: when the active block changes, ConceptStep also highlights the C lines representing that same step.

Loading flowchart…
3 · Flowchart ↔ C · Run in Page

Lab 1 — Run the example program

Run C executes only the example shown on the left, using stdin on the right. The coding challenge below has a separate editor and test button.

Final mini-project: temperature monitoring Start the flowchart to synchronize the code
                        1#include <stdio.h>
                        2 
                        3int main(void)
                        4{
                        5    int temperature[5] = {22, 24, 31, 28, 35};
                        6    int soglia;
                        7    scanf("%d", &soglia);
                        8 
                        9    int somma = 0;
                        10    int minimo = temperature[0];
                        11    int massimo = temperature[0];
                        12    int oltre = 0;
                        13 
                        14    for (int i = 0; i < 5; i = i + 1)
                        15    {
                        16        somma = somma + temperature[i];
                        17 
                        18        if (temperature[i] < minimo)
                        19            minimo = temperature[i];
                        20 
                        21        if (temperature[i] > massimo)
                        22            massimo = temperature[i];
                        23 
                        24        if (temperature[i] >= soglia)
                        25            oltre = oltre + 1;
                        26    }
                        27 
                        28    int media = somma / 5;
                        29    printf("%d\n", media);
                        30    printf("%d\n", minimo);
                        31    printf("%d\n", massimo);
                        32    printf("%d\n", oltre);
                        33 
                        34    if (oltre > 0)
                        35        printf("ALLERTA\n");
                        36    else
                        37        printf("OK\n");
                        38 
                        39    return 0;
                        40}
Ready. Make a prediction before running.

                    
                

Lab 2 — Coding challenge: write your code — Alert counter

Read five integer temperatures and a threshold; print how many meet or exceed it.

This is a different program from lab 1. Complete the starter code: Check all test cases compiles this editor and tests every input, including boundary cases.

4 · Guided practice

Check your prediction

With temperatures 22, 24, 31, 28, 35 and threshold 36, what final status should the program produce?

Challenge 1 / 5 · Understanding

Progress: 0 / 5 · correct: 0

Your competency map

What you need to know for Final mini-project: temperature monitoring

ConceptStep separates what is required from what is recommended or useful as reinforcement. Only required prerequisites block your progress.

Current topic Strong skill Review due Needs reinforcement To be mastered Optional support

Relationships: solid line = required · dashed line = recommended · dotted line = reinforcement.

GUIDED LEARNING PATHS

Want to choose the next skill to develop?