Test Informed Learning with Examples

Logo

Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.

Menu

Age statistics

Write a program that reads the age (an integer) of a set of people. Data entry will end when a negative value is entered. Your program has to calculate and display on the screen:

>>> %Run 
    Enter an age:50
    Enter an age:18
    Enter an age:0
    Enter an age:-2
    Average: 22.666666666666668
    Maximum age: 50
    Minimum age: 0
    People of working age: 2
>>> %Run 
    Enter an age:12
    Enter an age:16
    Enter an age:90
    Enter an age:65
    Enter an age:18
    Enter an age:17
    Enter an age:19
    Enter an age:66
    Enter an age:64
    Enter an age:-5
    Average: 40.77777777777778
    Maximum age: 90
    Minimum age: 12
    People of working age: 4
Insist that the students test their programs by giving them example
test executions.