Activity 01
Pair Programming: Calculator Functions
Pairs define functions for add, subtract, multiply, and divide, each taking two parameters and returning a value. They call these in a main program for user-input calculations. Test with edge cases like division by zero.
Explain the purpose of parameters in making functions more versatile.
Facilitation TipDuring Pair Programming: Calculator Functions, circulate and ask pairs to verbally predict what will print before they run code, reinforcing that functions don’t run until called.
What to look forPresent students with a simple program that uses a function with a parameter. Ask them to: 1. Identify the function name. 2. Identify the parameter. 3. State what argument would be passed to make the function print 'Hello, World!'.