Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.
Join our LinkedIN Community.
Use the following BibTeX entry to cite this work:
@INPROCEEDINGS{DVMB2023, author={Doorn, Niels and Vos, Tanja and MarĂn, Beatriz and Barendsen, Erik}, booktitle={2023 IEEE Conference on Software Testing, Verification and Validation (ICST)}, title={Set the right example when teaching programming: Test Informed Learning with Examples (TILE)}, year={2023}, volume={}, number={}, pages={269-280}, doi={10.1109/ICST57152.2023.00033} }
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:
the average of the ages,
the maximum and minimum age, and
how many of them are people of working age, that is, their age is between 18 and 65 years old
>>> %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.