Activity 01
Pair Programming: Grade Calculator
Pairs write a program using 'if-else if-else' to assign letter grades based on numeric scores. Test with sample inputs, then add 'switch' for bonus categories like pass/fail. Discuss which structure reads more clearly.
Compare the efficiency and readability of 'if-else if' chains versus 'switch' statements.
Facilitation TipDuring Pair Programming: Grade Calculator, circulate to ask each pair: 'How did you decide where to place each condition in the chain?' to reinforce sequential logic.
What to look forPresent students with a scenario, such as a simple grading scale (e.g., 90+ A, 80-89 B, etc.). Ask them to write pseudocode or actual code using 'else if' to represent this logic. Then, ask them to rewrite the same logic using a 'switch' statement if applicable, or explain why 'else if' is more suitable.