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

LinkedIN Community

Join our LinkedIN Community.

Determine if a product is positive, negative or zero without calculating it

Implement a program that reads two integer numbers and says if their product is positive, negative, or zero without doing the calculation.

Run the following combinations of examples to test that your program produces the same outputs:

>>> %Run
    Enter the first integer number: 0
    Enter the second integer number: -1
    The product is zero
>>> %Run 
    Enter the first integer number: 5
    Enter the second integer number: 0
    The product is zero
>>> %Run 
    Enter the first integer number: 0
    Enter the second integer number: 0
    The product is zero
>>> %Run 
    Enter the first integer number: 2
    Enter the second integer number: 7
    The product is positive
>>> %Run 
    Enter the first integer number: -4
    Enter the second integer number: -7
    The product is positive
>>> %Run 
    Enter the first integer number: -8
    Enter the second integer number: 3
    The product is negative
>>> %Run 
    Enter the first integer number: 10
    Enter the second integer number: -6
    The product is negative
Insist that the students test their programs by giving them example
test executions. Also pointing out that this way we try out all
possible combinations to test.