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 creates a dictionary that simulates a shopping cart. The program must ask for the item and its price, and add the pair to the dictionary, until the user decides to finish. Then, the shopping list and the total cost should be displayed, as in the following example:
>>> %Run
Enter a product: beer
Enter its price: 1.50
Do you want to continue? (Y/N): Y
Enter a product: wine
Enter its price: 4.50
Do you want to continue? (Y/N): Y
Enter a product: seed pack
Enter its price: 1.00
Do you want to continue? (Y/N): Y
Enter a product: fruit
Enter its price: 8
Do you want to continue? (Y/N): N
Product Price
--------------------
beer 1.50€
wine 4.50€
seed pack 1.00€
fruit 8.00€
--------------------
Total 15.00€
You can assume that the user only adds 1 sample of each product. Your tests can be run through the shell manually.