// Syntax: // Comment for reader's benefit, not parsed // # Template Number - +100 for each new type of problem, +10 for each new subtype // Learning Objective(s) for this template - when this template should be used // ? // If student gets the answer right, what OTHER objectives should get credit // Usually, counterpoint to the point of the error, say allocation for missing // deallocation, Declaration for out of scope error, assignment for incorrect // referencing, etc. // Make sure there is no overlap between this and antecedents! // : // If student gets the answer wrong, what OTHER objectives should get discredit // Make sure there is no overlap between this and antecedents! // > // The template itself, no double quotes, preceded and succeeded by a single > // > // Type: debug / output / code // Hardness: The student's correct percentage up to which this template will be used // Note: Syntax for learning objectives (in antecedent, ifCorrect, ifWrong) // is dot.separated, with {,} to represent alternates. // e.g., a.{b,c} is a.b and a.c // This is NOT graph structured, i.e., a,{b,c}.d is not accounted for to mean // a.b.d or a.c.d // FUTURE IMPROVEMENTS: // ADD TEMPLATES FOR POSTSTATEMENT FOR BOTH IF AND IFELSE // ADD TEMPLATES FOR DECLARATION/OTHER AS CONDITION OF IF ELSE // POSTSTATEMENT MAKES MOST SENSE WHEN IF CLAUSE IS EXECUTED AND ELSE CLAUSE IS A SIMPLE STATEMENT // CURRENTLY, POSTSTATEMENT ADDED WHEN IF CONDITION FALSE AND ELSE CLAUSE IS A SIMPLE STATEMENT... // IMPLEMENT DANGLING ELSE // for problems with condition such as variable = value, could print value of variable before if // for contrast. // For condition being var declaration, could have debugging problem where var is accessed after the if. // FOR TEMPLATES 835 AND UP - THE EXPLANATION ABOUT EXITING AN IF DOES NOT READ SMOOTHLY - GOES BACK // AND FORTH BETWEEN LINES. // FOR NESTED IF/IF-ELSE TEMPLATES, MAY WANT TO NOT ASK USER TO PRINT INPUT VARS, BUT ONLY // THE CALCULATED VAR - TO REDUCE COGNITIVE LOAD. e.g., if user calcuates index based // on amount and count, ask to print only index, not also amount and count.. // // ------------------------------------------------------------------------------- // The actual learning objectives: // 100 // Switch.Condition // --------------------------------------------------------------------------- // 100 // Selection.ifElse.Condition.Relational.true // All 6 relational operators, repeated twice // All 4 combinations of simple/compound if and else clauses // Typical complete case # 100 Switch.Condition > {(){=;switch(){ case 1: <<; break; case 2: << * 2; break; case 3: << + 1; break; default: << * ; }}} > Type: output Hardness: 20 // Case with missing breaks # 101 Switch.Condition > {(){=;switch(){ case 1: <<; case 2: << * 2; case 3: << + 1; default: << * ; }}} > Type: output Hardness: 30 // Case with merged cases # 102 Switch.Condition > {(){=;switch(){ case 1: case 2: <<; break; case 3: case 4: << + 1; break; default: << * ; }}} > Type: output Hardness: 20 // Case with expression in condition # 103 Switch.Condition > {(){=;switch( * 10){ case 10: <<; break; case 20: << * 2; break; case 30: << + 1; break; default: << * ; }}} > Type: output Hardness: 40 // Case with missing default # 104 Switch.Condition > {(){=;switch(){ case 1: <<; break; case 2: << * 2; break; case 3: << + 1; break; }}} > Type: output Hardness: 20 // Case with multiple switches, dependent # 105 Switch.Condition > {(){=;; switch(){ case 1: = 3; break; case 2: = 4; break; case 3: = 5; break; default: = 1; } switch(){ case 1: <<; break; case 2: << + 4; break; case 3: << * 5; break; default: << - 1; }}} > Type: output Hardness: 40 // -------------------------------------------------------------------------- // Templates here are for demonstration purposes // Included at the end so that regular practice does not pick up these templates // How to enter an output # 90 Demonstration > {(){=;<<;}} > Type: output Hardness: 10 // How to enter multiple outputs # 91 Demonstration > {(){=;<<;=;<<;<< - ;}} > Type: output Hardness: 10 // How to enter NO output # 92 Demonstration > {(){=;=;; = + ;}} > Type: output Hardness: 10 // --------------------------------------------------------------------------