// Copyright Amruth N. Kumar, amruth@computer.org // dowhile.txt Draft templates, with and without input REW 7/27/2010 // This is the master plan for the different loops // [Single Loop] // PassThrough - One Iteration // // Infinite // // [Many Iterations] - Normal case, not mentioned // Initialization // Yes // No // // Condition // No // [Exists] // Arithmetic // [True] // [False] // Logical // [Short Circuit + Side Effect] // [No Short Circuit] // Assignment // [True] // [False] // Relational // Boundary does not change // Boundary changes // // Action // Empty [statement] // Simple [statement] // Compound [statement] // // Update // None // After [body] // [Keyboard input] // [Expression] // Before [body] // [Keyboard input] // [Expression] // // PostLoop [Resume after loop] // // // Multiple [Back to back] // Dependent // [2 loop problems] - degrees of hardness // [3 loop problems] - degrees of hardness // [All loops of same type] - degrees of hardness // [Loops of different types] - degrees of hardness // Up [Counting] // Down [Counting] // // Independent // [2 loop problems] - degrees of hardness // [3 loop problems] - degrees of hardness // [All loops of same type] - degrees of hardness // [Loops of different types] - degrees of hardness // Up [Counting] // Down [Counting] // // Nested // Dependent // [2 loop problems] - degrees of hardness // [3 loop problems] - degrees of hardness // [All loops of same type] - degrees of hardness // [Loops of different types] - degrees of hardness // Up [Counting] // Down [Counting] // // Independent // [2 loop problems] - degrees of hardness // [3 loop problems] - degrees of hardness // [All loops of same type] - degrees of hardness // [Loops of different types] - degrees of hardness // Up [Counting] // Down [Counting] // // // ----------------------------------------------------------- // Other factors that affect template hardness: // Loop body: // Just a print statement // a constant // the loop counter // a simple expression involving the loopvar // the loopvar, boundary value (when boundary is a variable or expression) // an expression involving the loopvar and boundary value (when // it is a variable) - No, too complicated // an if-else statement with different variables in the two clauses // // Note that the type of operator, and its subtypes determine hardness, // not learning objectives. // Number of iterations: // Zero iterations // < > // far off value // boundary value // <= >= // far off value // == // far off value // != // same value // Only One iteration // Multiple iterations // < > // far off value // <= >= // far off value // boundary value // == // same value // != // n-removed value // // -------- do-while Learning Objectives -------------------- // PostTest.PassThrough - 100 - DONE // PostTest.Condition.Relational - 200 - DONE // PostTest.Condition.Arithmetic - 225 - DONE // PostTest.Condition.Assignment - 250 - DONE // PostTest.Condition.Logical.Range.Conjunct - 300 - DONE // PostTest.Condition.Logical.Range.Disjunct - 325 - DONE // PostTest.Condition.Logical.Discrete.Inclusionary - 350 - DONE // PostTest.Condition.Logical.Discrete.Exclusionary - 375 - DONE // PostTest.Condition.Logical.Negation - 400 - DONE // PostTest.Condition.Changing - 450 - DONE // monotonic increasing // monotonic decreasing // PostTest.Condition.No - 475 - DONE // PostTest.Multiple.Dependent - 500 - DONE // PostTest.Multiple.Independent - 525 - DONE // PostTest.Nested.Dependent - 550 - DONE // PostTest.Nested.Independent - 575 - DONE // // ------ Orthogonal Learning Objectives ----------------------- // // Condition.Boundary.Legal // Condition.Boundary.Illegal // // ------------------------------------------------------------------ // Templates from other loops not considered here: // // PostTest.Initialization.No // PostTest.Initialization.Yes // // PostTest.Condition.Logical // PostTest.Condition.Relational // // PostTest.Action.Empty // PostTest.Action.Simple // PostTest.Action.Compound // // PostTest.Update.No // PostTest.Update.Before // PostTest.Update.After // // PostTest.PostLoop // // -------Guidelines for creating Templates // (i) All do-while learning objectives will have problets with and without inputs // (ii) Problets will be modeled on inputting until a valid value // // A problem like 435 was original sample template for inputs // See June 19. 2010 email from Amruth for more guidelines //********************* DO-WHILE LOOPS ************************************ // ------------------------------------------------------------------------ // Iteration.Logic.PostTest.PassThrough - 100 // Intersperse, reversed: // Without input: // <=, >, ==, != (update before vs after printing) // With input: // <, >=, ==, != // Assignment before loop, output and update in loop, condition is greater than. # 100 PostTest.PassThrough ? PostTest.Condition.Relational > {(){=;do{ = - 1;<<;}while( > );}} > Type: debug_output Hardness: 30 // Demo problem // Input and output in loop, condition is greater than, first input clearly passes through # 101 PostTest.PassThrough ? PostTest.Condition.Relational > []{(){;do{>> ;<< ;}while( >= );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 30 // Assignment before loop, output and update in loop, condition is less than. # 102 PostTest.PassThrough ? PostTest.Condition.Relational > {(){=;do{ = + 1;<<;}while( <= );}} > Type: debug_output Hardness: 30 // Assignment before loop, output and update in loop, condition is equal to. # 103 PostTest.PassThrough ? PostTest.Condition.Relational > {(){=0;do{<<;>>;}while( != );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 30 // Pretest problem // Assignment before loop, output and update in loop, condition is equal to. # 104 PostTest.PassThrough ? PostTest.Condition.Relational > {(){=;do{<<; = + 1;}while( == );}} > Type: debug_output Hardness: 30 // Output and input in loop, condition is less than, first input is borderline and passes through # 105 PostTest.PassThrough ? Condition.Boundary.Illegal,PostTest.Condition.Relational > []{(){;do{>> ;<< ;}while( < );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 35 // Posttest problem // Assignment before loop, output and update in loop, condition is equal to. # 106 PostTest.PassThrough ? PostTest.Condition.Relational > {(){=;=;do{<<; = / 2;}while( == );}} > Type: debug_output Hardness: 30 // Assignment before loop, output and update in loop, condition is equal to. # 107 PostTest.PassThrough ? PostTest.Condition.Relational > []{(){;do{>>; = + 1;<<;}while( == );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 35 // ------------------------------------------------------------------------ // PostTest.Condition.Relational - 200 // Intersperse, reversed: (at least 3 iterations) // Without input: // <=, >, ==, != (update before vs after printing) // With input: // <, >=, ==, != // Assignment before loop, output and increment in loop, condition is less than. # 200 PostTest.Condition.Relational > {(){=;do{<<; = + 1;}while( < );}} > Type: debug_output Hardness: 30 // Assignment before loop, output and input in loop, condition is less than. # 201 PostTest.Condition.Relational ? Condition.Boundary.Illegal > [,]{(){=;do{<<;>>;}while( < );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 35 // Assignment before loop, output and decrement in loop, condition is greater than. # 202 PostTest.Condition.Relational > {(){=;do{ = - 1;<<;}while( >= );}} > Type: debug_output Hardness: 30 // Declaration before loop, input in loop, output after loop, condition is less than or equal. # 203 PostTest.Condition.Relational ? Condition.Boundary.Legal > []{(){;do{>>;}while( <= );<<;}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 35 // Pretest problem // Assignment before loop, increment by many and output in loop, condition is less than. # 204 PostTest.Condition.Relational > {(){=;do{ = + ;<<;}while( <= );}} > Type: debug_output Hardness: 35 // Declaration before loop, input and output in loop, condition is greater than. # 205 PostTest.Condition.Relational ? Condition.Boundary.Illegal > []{(){;do{>>;<<;}while( > );}} > Input: "\n\n\n\n\n0" > Type: debug_output Hardness: 35 // Posttest problem // Assignment before loop, decrement by many and output in loop, condition is greater than. # 206 PostTest.Condition.Relational ? Condition.Boundary.Illegal > [,,]{(){=;do{ = - ;<<;}while( > );}} > Type: debug_output Hardness: 35 // Declaration before loop, input in loop, output after loop, condition is greater than or equal. # 207 PostTest.Condition.Relational ? Condition.Boundary.Legal > []{(){;do{>>;}while( >= );<<;}} > Input: "\n\n\n\n\n13" > Type: debug_output Hardness: 35 // ------------------------------------------------------------------------ // PostTest.Condition.Arithmetic // Valid in C++ but syntax error in Java and C# // Interspersed: // Without input vs With input to variable involved in expression: // +, -, *, / // Assignment before loop, output and decrement in loop, condition variable. # 225 PostTest.Condition.Arithmetic > {(){=;do{<<; = - 1;}while();}} > Type: debug_output Hardness: 30 // Input is read and output is done in loop, condition is variable. # 226 PostTest.Condition.Arithmetic > {(){;do{>>;<<;}while();}} > Input: "\n\n\n0\n\n" > Type: debug_output Hardness: 30 // Pretest problem // Assignments before loop, output and increment in loop, condition is constant minus variable. # 227 PostTest.Condition.Arithmetic > {(){=; do{<<; = + 1;}while( - );}} > Type: debug_output Hardness: 30 // Input is read and output is done in loop, condition is constant minus variable. # 228 PostTest.Condition.Arithmetic > []{(){;do{>>;<<;}while( - );}} > Input: "\n\n\n0\n\n2" > Type: debug_output Hardness: 30 // Posttest problem // Assignments before loop, decrement and output in loop, condition is variable minus constant. # 229 PostTest.Condition.Arithmetic > {(){=; do{ = - 1;<<;}while( - );}} > Type: debug_output Hardness: 30 // Demo problem // Input is read and output is done in loop, condition is variable minus constant. # 230 PostTest.Condition.Arithmetic > []{(){;do{>>;}while( - );<<;}} > Input: "\n9\n\n\n\n2" > Type: debug_output Hardness: 30 # 231 PostTest.Condition.Arithmetic > [,]{(){=;do{<<; = - ;}while( * );}} > Type: debug_output Hardness: 35 # 232 PostTest.Condition.Arithmetic > {(){;do{>>;<<;}while( * );}} > Input: "\n\n0\n\n\n" > Type: debug_output Hardness: 35 # 233 PostTest.Condition.Arithmetic > [,]{(){=;do{ = - ;<<;}while( * );}} > Type: debug_output Hardness: 30 # 234 PostTest.Condition.Arithmetic > {(){;do{>>;<<;}while( * );}} > Input: "\n\n0\n\n\n" > Type: debug_output Hardness: 30 // ------------------------------------------------------------------------ // PostTest.Condition.Assignment // Infinite loop in C++, // Syntax error in Java, and C# // Variation in what is assigned to variable: // const value, variable to which value was input in loop, // expression involving variable to which value was not/was input in loop // Assignment before loop, output and increment in loop # 250 PostTest.Condition.Assignment > {(){=;ido{<<; = + 1;}while( = );}} > Type: debug_output Hardness: 30 // Input is read and output is done in loop # 251 PostTest.Condition.Assignment > [,,,,] {(){;ido{>>;<<;}while( = );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 30 // Pretest problem // Assignment before loop, increment and output in loop # 252 PostTest.Condition.Assignment > {(){=;ido{ = + ;<<;}while( = );}} > Type: debug_output Hardness: 30 // Variable assigned before loop, output is done and input is read in loop # 253 PostTest.Condition.Assignment > [,,,,] {(){ = ;ido{<<;>>;}while( = );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 30 // Assignment before loop, decrement and output in loop # 254 PostTest.Condition.Assignment > {(){=;ido{<<; = - 1;}while( = );}} > Type: debug_output Hardness: 30 // Demo problem // Input is read and and incremented and output is done in loop # 255 PostTest.Condition.Assignment > [,,,,] {(){;ido{>>; = +;<<;}while( = );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 30 // Posttest problem // Assignment before loop, output and decrement in loop # 256 PostTest.Condition.Assignment > {(){=;ido{ = - ;<<;}while( = );}} > Type: debug_output Hardness: 30 // Input is read and and incremented and output is done in loop # 257 PostTest.Condition.Assignment > [,,,,] {(){;ido{>>; = - ;<<;}while( = );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 30 // ------------------------------------------------------------------------ // PostTest.Condition.Logical.Range.Conjunct - 300 // Intersperse: // Without input // Increment by 1 // Decrement by 1 // Increment by many // Decrement by many // With input // Ends with illegal low // Ends with illegal high // Ends with boundary illegal low // Ends with boundary illegal high // Variable is output and incremented in the loop # 300 PostTest.Condition.Logical.Range.Conjunct > {(){=; do{<<; = + 1;}while( >= && <= );}} > Type: debug_output Hardness: 30 // Demo problem // Variable is assigned before, output and input in the loop, Ends with illegal high # 301 PostTest.Condition.Logical.Range.Conjunct > [,,]{(){=; do{<< ;>> ;}while( >= && <= );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 40 // Variable is decremented and output in the loop # 302 PostTest.Condition.Logical.Range.Conjunct > {(){=; do{ = - 1;<<;}while( > && <= );}} > Type: debug_output Hardness: 30 // Variable is assigned before, output and input in the loop, Ends with illegal low # 303 PostTest.Condition.Logical.Range.Conjunct > [,,]{(){=; do{>> ;}while( > && < );<< ;}} > Input: "\n\n0\n\n\n" > Type: debug_output Hardness: 40 // Variable is incremented by many and output in the loop # 304 PostTest.Condition.Logical.Range.Conjunct > {(){=; do{ = + ;<<;}while( >= && < );}} > Type: debug_output Hardness: 30 // Pretest problem // Variable is input in the loop and output after loop, Ends with boundary illegal low # 305 PostTest.Condition.Logical.Range.Conjunct ? Condition.Boundary.Illegal > [,]{(){;do{>> ;}while( > && <= );<< ;}} > Input: "\n\n\n\n\n0" > Type: debug_output Hardness: 45 // Variable is decremented by many and output in the loop # 306 PostTest.Condition.Logical.Range.Conjunct > [,,]{(){=; do{ = - ;<<;}while( > && <= );}} > Type: debug_output Hardness: 30 // Posttest problem // Variable is input and output in the loop, Ends with boundary illegal high # 307 PostTest.Condition.Logical.Range.Conjunct ? Condition.Boundary.Illegal > [,]{(){;do{>> ;<< ;}while( >= && < );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 45 // ------------------------------------------------------------------------ // PostTest.Condition.Logical.Range.Disjunct - 325 // Intersperse: // Without input // Increment by 1 in lower range // Decrement by 1 in upper range // Increment by many in lower range // Decrement by many in upper range // With input // Ends with illegal // Ends with boundary lower range upper limit // Ends with boundary upper range lower limit // Variable is output and incremented in the loop # 325 PostTest.Condition.Logical.Range.Disjunct > {(){=; do{<<; = + 1;}while( < || >= );}} > Type: debug_output Hardness: 30 // Demo problem // Variable is input in the loop and output after loop, Ends with illegal # 326 PostTest.Condition.Logical.Range.Disjunct ? Condition.Boundary.Legal > [,]{(){;do{>> ;<< ;}while( <= || > );}} > Input: "\n\n\n\n0\n" > Type: debug_output Hardness: 45 // Variable is decremented and output in the loop # 327 PostTest.Condition.Logical.Range.Disjunct > {(){=; do{ = - 1;<<;}while( <= || > );}} > Type: debug_output Hardness: 30 // Pretest problem // Variable is input and output in the loop, Ends with boundary lower range upper limit # 328 PostTest.Condition.Logical.Range.Disjunct ? Condition.Boundary.{Illegal,Legal} > [,]{(){;do{>> ;<< ;}while( < || >= );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 45 // Variable is incremented by 2-4 and output in the loop # 329 PostTest.Condition.Logical.Range.Disjunct > [,,,]{(){=; do{ = + ;<<;}while( < || >= );}} > Type: debug_output Hardness: 35 // Posttest problem // Variable is assigned before, output and input in the loop, Ends with boundary upper range lower limit # 330 PostTest.Condition.Logical.Range.Disjunct ? Condition.Boundary.{Illegal,Legal} > [,,]{(){=; do{<< ;>> ;}while( <= || > );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 45 // Variable is decremented by 2-4 and output in the loop # 331 PostTest.Condition.Logical.Range.Disjunct > [,,,,]{(){=; do{<<; = - ;}while( <= || > );}} > Type: debug_output Hardness: 35 // ------------------------------------------------------------------------ // PostTest.Condition.Logical.Discrete.Inclusionary // Intersperse: // Without input (discrete values are uniformly spaced) // Increment by many to visit discrete values // Decrement by many to visit discrete values // Multiply to step between various products of a factor (increasing) // With input - randomly visits randomly spaced discrete values // Ends with illegal over // Ends with illegal under // Ends with illegal in between // Variable is incremented by 3-5 and output in the loop # 350 PostTest.Condition.Logical.Discrete.Inclusionary > [,] {(){=;do{ = + ;<<;} while( == || == || == );}} > Type: debug_output Hardness: 30 // Demo problem // Variable is input in the loop and output after loop # 351 PostTest.Condition.Logical.Discrete.Inclusionary > [,,,,] {(){;do{>> ;} while( == || == || == );<< ;}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 40 // Variable is decremented by 3-5 and output in the loop # 352 PostTest.Condition.Logical.Discrete.Inclusionary > [,,] {(){=;do{<<; = - ;} while( == || == || == );}} > Type: debug_output Hardness: 30 // Pretest problem // Variable is input and output in the loop # 353 PostTest.Condition.Logical.Discrete.Inclusionary > [,,]{(){;do{>> ;<< ;} while( == || == || == );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 40 // Variable is printed and changed in the loop # 354 PostTest.Condition.Logical.Discrete.Inclusionary > [,,,] {(){=;do{<<; = / ;} while( == || == || == );}} > Type: debug_output Hardness: 30 // Posttest problem // Variable is assigned before, input, incremented and output in the loop # 355 PostTest.Condition.Logical.Discrete.Inclusionary > [,,,]{(){;do{>> ; = + ;<< ;} while( == || == || == );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 40 // ------------------------------------------------------------------------ // PostTest.Condition.Logical.Discrete.Exclusionary - 375 // Intersperse: // Without input (discrete values are uniformly spaced) // Increment by one to visit discrete values // Decrement by one to visit discrete values // Increment by many to visit discrete values // Decrement by many to visit discrete values // With input - randomly visits randomly spaced discrete values // output after loop // input and output in loop // output and input in loop // Variable is output and incremented in the loop, condition is conjunction of three not equals # 375 PostTest.Condition.Logical.Discrete.Exclusionary > [,,,] {(){=;do{<<; = + 1;} while( != && != && != );}} > Type: debug_output Hardness: 30 // Demo problem // Variable is input in the loop and output after loop # 376 PostTest.Condition.Logical.Discrete.Exclusionary > [,,,,] {(){;do{>> ;} while( != && != && != );<< ;}} > Input: "\n\n\n\n\n\n\n\n" > Type: debug_output Hardness: 40 // Variable is decremented and output in the loop # 377 PostTest.Condition.Logical.Discrete.Exclusionary > [,,,] {(){=;do{ = - 1;<<;} while( != && != && != );}} > Type: debug_output Hardness: 30 // Pretest problem // Variable is input and output in the loop # 378 PostTest.Condition.Logical.Discrete.Exclusionary > [,,]{(){;do{>> ;<< ;} while( != && != && != );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 40 // Variable is incremented by 3-5 and output in the loop # 379 PostTest.Condition.Logical.Discrete.Exclusionary > [,] {(){=;do{ = + ;<<;} while( != && != && != );}} > Type: debug_output Hardness: 35 // Posttest problem // Variable is assigned before, output and input in the loop # 380 PostTest.Condition.Logical.Discrete.Exclusionary > [,,,]{(){=;do{<< ;>> ;} while( != && != && != );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 40 // Variable is decremented by 3-5 and output in the loop # 381 PostTest.Condition.Logical.Discrete.Exclusionary > [,,] {(){=;do{<<; = - ;} while( != && != && != );}} > Type: debug_output Hardness: 35 // ------------------------------------------------------------------------ // PostTest.Condition.Logical.Negation - 400 // EXACT opposite of Condition.Relational // Intersperse: // Without input // Increment by 1, ! > // Decrement by 1, ! < // Increment by many, ! >= // Decrement by many, ! <= // With input // Ends with illegal over, ! > // Ends with illegal under, ! < // Ends with boundary, ! >= // Ends with boundary, ! <= // Assignment before loop, output and increment in loop, condition is less than. # 400 PostTest.Condition.Logical.Negation > {(){=;do{<<; = + 1;}while(!( >= ));}} > Type: debug_output Hardness: 30 // Assignment before loop, output and input in loop, condition is less than. # 401 PostTest.Condition.Logical.Negation ? Condition.Boundary.Illegal > [,]{(){=;do{<<;>>;}while(!( >= ));}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 35 // Assignment before loop, output and decrement in loop, condition is greater than. # 402 PostTest.Condition.Logical.Negation > {(){=;do{ = - 1;<<;}while(!( < ));}} > Type: debug_output Hardness: 30 // Pretest problem // Declaration before loop, input in loop, output after loop, condition is less than or equal. # 403 PostTest.Condition.Logical.Negation ? Condition.Boundary.Legal > []{(){;do{>>;}while(!( > ));<<;}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 35 // Assignment before loop, increment by many and output in loop, condition is less than. # 404 PostTest.Condition.Logical.Negation > {(){=;do{ = + ;<<;}while(!( > ));}} > Type: debug_output Hardness: 35 // Demo problem // Declaration before loop, input and output in loop, condition is greater than. # 405 PostTest.Condition.Logical.Negation ? Condition.Boundary.Illegal > []{(){;do{>>;<<;}while(!( <= ));}} > Input: "\n\n\n\n\n0" > Type: debug_output Hardness: 35 // Assignment before loop, decrement by many and output in loop, condition is greater than. # 406 PostTest.Condition.Logical.Negation > [,,]{(){=;do{ = - ;<<;}while(!( <= ));}} > Type: debug_output Hardness: 35 // Posttest problem // Declaration before loop, input in loop, output after loop, condition is greater than or equal. # 407 PostTest.Condition.Logical.Negation ? Condition.Boundary.Legal > []{(){;do{>>;}while(!( < ));<<;}} > Input: "\n\n\n\n\n13" > Type: debug_output Hardness: 35 // ------------------------------------------------------------------------ // PostTest.Condition.Changing - 450 // Intersperse // Without input: - Commented out // var1 < var2: var1++, var2-- // var1 >= var2: var1--, var2++ // With input for var1: // var1 < var2: var2-- // var1 >= var2: var2++ // With input for var2: // var1 = var2; >> var2; while( var1 < var2 ) // var1 = var2; >> var2; while( var1 > var2 ) // With input for var1 and var2: // var1 <= var2 // var1 >= var2 // var1 != var2 // var1 == var2 // // COMMENTED OUT BECAUSE THESE COULD AS WELL BE IN FOR LOOP // // Assignments before loop, output and increment and decrement in loop, condition is less than. // # 450 // PostTest.Condition.Changing // > // {(){=;=; // do{<<;<<; = + 1; = - 1;}while( < );}} // > // Type: debug_output // Hardness: 40 // // // Assignment before loop, output and decrement and increment in loop, condition is greater than. // # 452 // PostTest.Condition.Changing // > // {(){=;=; // do{ = - 1; = + 1;<<;<<;}while( > );}} // > // Type: debug_output // Hardness: 40 // Two variables, one assignment before loop, one variable input and other decremented in loop, // both variables output in loop, condition is less than. # 450 PostTest.Condition.Changing ? Condition.Boundary.Legal,PostTest.Condition.Relational > []{(){;=; do{>>;<<;<<; = - 1;}while( <= );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 45 // Two variables declared before loop, both variables input in loop, // both variables output in loop, condition is greater than. # 451 PostTest.Condition.Changing ? PostTest.Condition.Relational > {(){;; do{>>;>>;<<;<<;}while( > );}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 50 // Two variables, one assignment before loop, one variable input and other decremented in loop, // both variables output in loop, condition is less than. # 452 PostTest.Condition.Changing ? Condition.Boundary.Legal,PostTest.Condition.Relational > []{(){;=; do{>>; = + 1;<<;<<;}while( >= );}} > Input: "\n\n\n\n0" > Type: debug_output Hardness: 45 // Two variables declared before loop, both variables input in loop, // both variables output in loop, condition is greater than. # 453 PostTest.Condition.Changing ? PostTest.Condition.Relational > {(){;; do{>>;<<;>>;<<;}while( < );}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 50 // Two variables, one assignment before loop, one variable input and other decremented in loop, // both variables output in loop, condition is less than. # 454 PostTest.Condition.Changing ? PostTest.Condition.Relational > []{(){=;; do{>>;<<; = - 1;<<;}while( > );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 40 // Two variables declared before loop, both variables input in loop, // both variables output in loop, condition is greater than. # 455 PostTest.Condition.Changing ? PostTest.Condition.Relational > {(){;; do{>>;>>;<<;<<;}while( != );}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 50 // Two variables, one assignment before loop, one variable input and other decremented in loop, // both variables output in loop, condition is less than. # 456 PostTest.Condition.Changing ? PostTest.Condition.Relational > []{(){=;; do{>>;<<;<<; = + 1;}while( < );}} > Input: "\n\n\n\n5" > Type: debug_output Hardness: 40 // Pretest problem // Two variables declared before loop, one variable input in loop, other updated to first variable's value, // both variables output in loop, condition is greater than. // Monotonically increasing # 460 PostTest.Condition.Changing ? Condition.Boundary.Legal,PostTest.Condition.Relational > {(){=0;; do{ = ;>>;<<;}while( >= );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 60 // Posttest problem // Two variables declared before loop, one variable input in loop, other updated to first variable's value, // both variables output in loop, condition is greater than. // Monotonically decreasing # 461 PostTest.Condition.Changing ? Condition.Boundary.Legal,PostTest.Condition.Relational > []{(){=;; do{ = ;>>;<<;}while( <= );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 60 // Demo problem // Two variables declared before loop, one variable input in loop, other updated to first variable's value, // both variables output in loop, condition is greater than. // Continually changing # 462 PostTest.Condition.Changing ? PostTest.Condition.Relational > []{(){=;; do{ = ;>>;<<;}while( != );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 60 // ------------------------------------------------------------------------ // PostTest.Condition.Condition of the loop is empty // Syntax error in C++, Java, and C# // Variation in body (output in all cases): // No input, with input, // Assignment before loop, output and increment in loop # 475 PostTest.Condition.Condition of the loop is empty > {(){=;do{<<; = + 1;}while();}} > Type: debug_output Hardness: 30 // Input is read and output is done in loop # 476 PostTest.Condition.Condition of the loop is empty > {(){;do{>>;<<;}while();}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 30 // Pretest problem // Assignment before loop, increment and output in loop # 477 PostTest.Condition.Condition of the loop is empty > {(){=;do{ = + ;<<;}while();}} > Type: debug_output Hardness: 30 // Demo problem // Variable assigned before loop, output is done and input is read in loop # 478 PostTest.Condition.Condition of the loop is empty > []{(){ = ;do{<<;>>;}while();}} > Input: "\n\n\n0\n\n" > Type: debug_output Hardness: 30 // Assignment before loop, output and decrement in loop # 479 PostTest.Condition.Condition of the loop is empty > {(){=;do{<<; = - 1;}while();}} > Type: debug_output Hardness: 30 // Input is read and and incremented and output is done in loop # 480 PostTest.Condition.Condition of the loop is empty > []{(){;do{>>; = +;<<;}while();}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 30 // Posttest problem // Assignment before loop, decrement and output in loop # 481 PostTest.Condition.Condition of the loop is empty > {(){=;do{ = - ;<<;}while();}} > Type: debug_output Hardness: 30 // Input is read and decremented and output is done in loop # 482 PostTest.Condition.Condition of the loop is empty > []{(){;do{>>; = -;<<;}while();}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 30 // ------------------------------------------------------------------------ // PostTest.Multiple.Dependent - 500 // First loop reads value into a variable, // Second loop prints up to or from it, inc/dec // First loop reads value into a variable, // Second loop continues to read into the same variable after printing the value // First loop reads value into a variable, // Second loop uses it in condition to read value into a second variable // // COMMENTED OUT SINCE THESE COULD JUST AS WELL BE FOR LOOPS // //2-loops, two variables output and incremented in first loop, // // second variable output and incremented in second loop // # 500 // PostTest.Multiple.Dependent // > // {(){=;=; // do{<<;<<; = + 1; = + 1;}while( < ); // do{<<; = + 1;}while( < );}} // > // Type: debug_output // Hardness: 70 // // //2-loops, two variables decremented and output in first loop, // // second variable incremented and output in second loop // # 501 // PostTest.Multiple.Dependent // > // {(){=;=; // do{ = - 1; = - 1;<<;<<;}while( > ); // do{ = + 1;<<;}while( < );}} // > // Type: debug_output // Hardness: 70 // // //3-loops, single variable output and incremented in first loop, // // output and decremented in second loop, output and incremented in third loop // # 502 // PostTest.Multiple.Dependent // > // {(){=; // do{<<; = + 1;}while( < ); // do{<<; = - 1;}while( > ); // do{<<; = + 1;}while( < );}} // > // Type: debug_output // Hardness: 80 // 2 loops, single variable input in first loop // and second variable incremented up to first variable in second loop # 500 PostTest.Multiple.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,,,] {(){;do{>> ;<<;}while( >= ); = ;do{<< ; = + 1;}while( < );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 45 // Pretest problem // 2 loops, single variable input and output in first loop // and used in condition of second loop to read into a second variable # 501 PostTest.Multiple.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,,] {(){;do{>> ;<<;}while( <= ); ;do{>> ;}while( > );<<;}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 65 // 2 loops, single variable input in first loop // and second variable decremented down to first variable in second loop # 502 PostTest.Multiple.Dependent ? PostTest.Condition.Relational > [,,,,] {(){;do{>> ;<<;}while( < ); do{<< ; = - 1;}while( >= );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 40 // Posttest problem // 2 loops, single variable input and output in first loop // and used in condition of second loop to read into a second variable # 503 PostTest.Multiple.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,,] {(){;do{>> ;}while( > );<<; ;do{>> ;}while( <= );<<;}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 65 // 2 loops, single variable input and output in first loop // and same variable decremented in second loop # 504 PostTest.Multiple.Dependent ? PostTest.Condition.Relational > [,,,,] {(){;do{>> ;<<;}while( == ); do{ = - ;<<;}while( != );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 40 // 2 loops, single variable input and output in first loop // and used in condition of second loop to read into a second variable # 505 PostTest.Multiple.Dependent ? PostTest.Condition.Relational > [,,] {(){;do{>> ;<<;}while( == ); do{<<;>> ;}while( != );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 60 //2 loops, single variable input and output in first loop // and same variable output and input in second loop, output after loops # 506 PostTest.Multiple.Dependent ? PostTest.Condition.Relational > [,] {(){;do{>> ;<<;}while( > ); do{>> ;<<;}while( < );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 70 // Demo problem # 507 PostTest.Multiple.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,] {(){; = ;do{>> ;<<;}while( <= ); do{>> ;<< ;}while( <= );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 45 // ------------------------------------------------------------------------ // PostTest.Multiple.Independent - 525 // // COMMENTED OUT SINCE THIS IS SIMILAR TO FOR LOOPS // // 2-loops, a variable output and incremented in first loop, // // second variable output and incremented in second loop // # 525 // PostTest.Multiple.Independent // > // {(){=; // do{<<; = + 1;}while( < ); // =;do{<<; = + 1;}while( <= );}} // > // Type: debug_output // Hardness: 70 // // //2-loops, a variables decremented and output in first loop, // // second variable incremented and output in second loop // # 526 // PostTest.Multiple.Independent // > // {(){=; // do{ = - 1;<<;}while( >= ); // =;do{ = + 1;<<;}while( < );}} // > // Type: debug_output // Hardness: 70 // // //3-loops, a variable output and incremented in first loop, // // second variable output and decremented in second loop, // // third variable output and incremented in third loop // # 527 // PostTest.Multiple.Independent // > // {(){=; // do{<<; = + 1;}while( < ); // =;do{<<; = - 1;}while( > );}} // =;do{<<; = + 1;}while( <= );}} // > // Type: debug_output // Hardness: 80 // 2 loops, single variable input and output in first loop // and same variable output and input in second loop # 525 PostTest.Multiple.Independent ? Condition.Boundary.Legal,PostTest.Condition.Relational > []{(){;do{>> ;<<;}while( >= ); do{>> ;}while( < );<<;}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 55 // 2 loops, single variable input and output in first loop // and second variable output and input in second loop # 526 PostTest.Multiple.Independent ? Condition.Boundary.{Illegal,Legal},PostTest.Condition.Relational > [,,,] {(){;do{>> ;<<;}while( <= ); ;do{>> ;}while( > );<<;}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 55 // Pretest problem // 2 loops, single variable input and output in first loop // and same variable output and input in second loop # 527 PostTest.Multiple.Independent ? Condition.Boundary.Legal,PostTest.Condition.Relational > []{(){;do{>> ;}while( < );<<; do{<<;>> ;}while( >= );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 55 // Demo problem // 2 loops, single variable input and output in first loop // and second variable output and input in second loop # 528 PostTest.Multiple.Independent ? Condition.Boundary.{Illegal,Legal},PostTest.Condition.Relational > [,,,] {(){;do{>> ;}while( > );<<; ;do{>> ;<<;}while( <= );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 55 // 2 loops, single variable input and output in first loop // and same variable output and input in second loop # 529 PostTest.Multiple.Independent ? PostTest.Condition.Relational > []{(){;do{>> ;<<;}while( == ); do{<<;>> ;}while( != );}} > Input: "\n\n\n\n\n " > Type: debug_output Hardness: 50 // 2 loops, single variable input and output in first loop // and second variable output and input in second loop # 530 PostTest.Multiple.Independent ? PostTest.Condition.Relational > [,,] {(){;do{>> ;<<;}while( != ); ;do{>> ;<<;}while( == );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 50 // Posttest problem //2 loops, 1 variable, input and output in both loop // first condition <, second condition > # 531 PostTest.Multiple.Independent ? Condition.Boundary.Illegal,PostTest.Condition.Relational > [,]{(){;do{>> ;<<;}while( < ); do{>> ;<<;}while( > );}} > Input: "\n\n\n\n\n\n" > Type: debug_output Hardness: 50 // 2 loops, 2 variables, input and output in both loops, // first condition >=, second condition <= # 532 PostTest.Multiple.Independent ? Condition.Boundary.{Illegal,Legal},PostTest.Condition.Relational > [,]{(){;do{>> ;<<;}while( >= ); ;do{>> ;<<;}while( <= );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 55 // TOO COMPLICATED? // //3-loops, a variable input and output in first loop, // // 2nd variable assigned before 2nd loop, output and input in 2nd loop, // // 3rd variable assigned before 3rd loop, output and input in 3rd loop, // // 1st condition <, 2nd condition >, 3rd condition <= // # 537 // PostTest.Multiple.Independent // > // [,,,,] // {(){;do{>> ;<<;}while( < ); // =;do{<<;>> ;}while( > );}} // =;do{<<;>> ;}while( <= );}} // > // Input: " " // > // Type: debug_output // Hardness: 80 // ------------------------------------------------------------------------ // PostTest.Nested.Dependent - 550 // // COMMENTED OUT - SIMILAR TO FOR LOOP TEMPLATES // // Pair of nested loops, two variables output and one incremented in inside loop with condition <, // // other variable incremented by 2 after first loop in second loop with condition < // # 550 // PostTest.Nested.Dependent // > // {(){=;=; // do{do{<<;<<; = + 1;}while( < ); = + 2;}while( < 5);}} // > // Type: debug_output // Hardness: 70 // // // Pair of nested loops, 2 variable, one variable incremented and the other assigned before inside loop // // both variables output and the second variable decremented in inside loop with condition >=, // // outside loop has condition < // # 551 // PostTest.Nested.Dependent // > // {(){=;; // do{=+1;=;do{ = - 1;<<;<<;}while( >= ); // }while( < );}} // > // Type: debug_output // Hardness: 70 // // // Pair of nested loops, 2 variable, second variable assigned the first variable, // // then the first variable incremented before inside loop // // both variables output and the second variable incremented in inside loop with condition >, // // outside loop has condition < // # 552 // PostTest.Nested.Dependent // > // {(){=;; // do{=; = + 1;do{<<; = - 1;<<;}while( > ); // }while( < );}} // > // Type: debug_output // Hardness: 70 // Increment a variable in outside loop, read into second variable // while greater than it in inside loop # 550 PostTest.Nested.Dependent ? PostTest.Condition.Relational > [,] {(){=;; do{ = + 1;<<; do{>>;<< ;}while( > ); }while( < );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 50 // Pretest problem // Read in outside loop, print up to it in inside loop # 551 PostTest.Nested.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [] {(){;; do{>>;<<;=; do{<< ; = + 1;}while( < ); }while( <= );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 55 // Decrement a variable in outside loop, read into second variable while less than it in inside loop # 552 PostTest.Nested.Dependent ? PostTest.Condition.Relational > [,] {(){=;; do{ = - 1;<<; do{>>;<< ;}while( < ); }while( > );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 50 // Posttest problem // Read in outside loop, print down from it in inside loop # 553 PostTest.Nested.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [] {(){;; do{>>;<<;=; do{<< ; = - 1;}while( > ); }while( >= );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 55 // Increment a variable by many in outside loop, read into second variable while >= than it in inside loop # 554 PostTest.Nested.Dependent ? PostTest.Condition.Relational > [,,] {(){=;; do{ = + ;<<; do{>>;<< ;}while( >= ); }while( < );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 50 # 555 PostTest.Nested.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,] {(){;; do{>>;<<;=; do{<< ; = + ;}while( <= ); }while( >= );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 55 // Decrement a variable by many in outside loop, read into second variable while <= than it in inside loop # 556 PostTest.Nested.Dependent ? PostTest.Condition.Relational > [,,] {(){=;; do{ = - ;<<; do{>>;<< ;}while( <= ); }while( > );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 50 # 557 PostTest.Nested.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,] {(){;; do{>>;<<;=; do{<< ; = - ;}while( >= ); }while( <= );}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 55 // Pair of nested loops, 2 variables, 1 variable input before inner loop, // other variable input in inner loop and both variables output in inner loop // both conditions use < # 560 PostTest.Nested.Dependent ? Condition.Boundary.{Illegal,Legal},PostTest.Condition.Relational > [,,]{(){;; do{>>;<<;do{>>;}while( < );<<;}while( < );}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 60 // Demo problem // Pair of nested loops, 2 variables, 1 variable input and output before inner loop, // other variable input and output in inner loop, conditions are >= and < # 561 PostTest.Nested.Dependent ? Condition.Boundary.{Illegal,Legal},PostTest.Condition.Relational > []{(){;; do{>>;do{>>;<<;}while( >= );<<;}while( < );}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 70 // Pair of nested loops, 2 variables, 1 variable input before inner loop and output after, // other variable input and output in inner loop, conditions are > and >= # 562 PostTest.Nested.Dependent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,]{(){;; do{>>;do{>>;<<;}while( > );<<;}while( >= );}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 65 // Pair of nested loops, 2 variables, 1 variable input before inner loop and output after, // other variable input and output in inner loop, conditions are > and >= # 563 PostTest.Nested.Dependent ? Condition.Boundary.Illegal,PostTest.Condition.Relational > [,,]{(){;; do{>>;<<;do{>>;}while( <= );<<;}while( > );}} > Input: "\n\n\n\n\n\n\n" > Type: debug_output Hardness: 65 // ------------------------------------------------------------------------ // PostTest.Nested.Independent - 575 // COMMENTED OUT - VERY SIMILAR TO COUNTER LOOPS // // 575-578 Problets from original do-while file // //Nested Up-Counting - 2-levels // # 575 // PostTest.Nested.Independent // > // {(){=;do{=; // do{<<;<<; = + 1;}while( < 3); = + 1;}while( < 3);}} // > // Type: debug_output // Hardness: 70 // // //3-levels // # 576 // PostTest.Nested.Independent // > // {(){=;do{=; // do{=;do{<<;<<;<<; = + 1;}while( < 2); // = + 1;}while( < 2); = + 1;}while( < 2);}} // > // Type: debug_output // Hardness: 80 // // //Nested Down-Counting // //2-levels // # 577 // PostTest.Nested.Independent // > // {(){=;do{=; // do{<<;<<; = - 1;}while( > 0); = - 1;}while( > 0);}} // > // Type: debug_output // Hardness: 70 // // //3-levels // # 578 // PostTest.Nested.Independent // > // {(){=;do{=; // do{=;do{<<;<<;<<; = - 1;}while( >= 0); // = - 1;}while( >= 0); = - 1;}while( >= 0);}} // > // Type: debug_output // Hardness: 80 // COPIED DEPENDENT TEMPLATES AND MODIFIED THEM // Increment a variable in outside loop, read into second variable while greater than it in inside loop # 575 PostTest.Nested.Independent ? Condition.Boundary.Illegal,PostTest.Condition.Relational > [,] {(){=;; do{ = + 1;<<; do{>>;<< ;}while( > ); }while( < );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 50 // Pair of nested loops, 2 variables, 1 variable input before inner loop, // other variable input in inner loop and both variables output in inner loop // both conditions use < # 576 PostTest.Nested.Independent ? Condition.Boundary.Illegal,PostTest.Condition.Relational > [,,]{(){;; do{>>;<<;do{>>;}while( < );<<;}while( < );}} > Input: "\n\n\n\n\n\n\n\n" > Type: debug_output Hardness: 65 // Decrement a variable in outside loop, read into second variable while less than it in inside loop # 577 PostTest.Nested.Independent ? Condition.Boundary.Illegal,PostTest.Condition.Relational > [,] {(){=;; do{<<; do{>>;<< ;}while( < ); = - 1;}while( > );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 50 // Pretest problem // Pair of nested loops, 2 variables, 1 variable input and output before inner loop, // other variable input and output in inner loop, conditions are >= and < # 578 PostTest.Nested.Independent ? Condition.Boundary.{Illegal,Legal},PostTest.Condition.Relational > [,,]{(){;; do{>>;do{>>;<<;}while( >= );<<;}while( < );}} > Input: "\n\n\n\n\n\n\n\n" > Type: debug_output Hardness: 70 // Increment a variable by many in outside loop, read into second variable while >= than it in inside loop # 579 PostTest.Nested.Independent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,] {(){=;; do{<<; do{>>;<< ;}while( >= ); = + ;}while( < );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 55 // Posttest problem // Pair of nested loops, 2 variables, 1 variable input before inner loop and output after, // other variable input and output in inner loop, conditions are > and >= # 580 PostTest.Nested.Independent ? Condition.Boundary.{Illegal,Legal},PostTest.Condition.Relational > [,,] {(){;; do{>>;do{>>;}while( > );<<;<<;}while( >= );}} > Input: "\n\n\n\n\n\n\n\n" > Type: debug_output Hardness: 70 // Decrement a variable by many in outside loop, read into second variable while >= than it in inside loop # 581 PostTest.Nested.Independent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,] {(){=;; do{ = - ;<<; do{>>;<< ;}while( <= ); }while( > );}} > Input: "\n\n\n\n\n" > Type: debug_output Hardness: 55 // Pair of nested loops, 2 variables, 1 variable input before inner loop and output after, // other variable input and output in inner loop, conditions are > and >= # 582 PostTest.Nested.Independent ? Condition.Boundary.Legal,PostTest.Condition.Relational > [,,] {(){;; do{>>;<<;do{>>;<<;}while( <= );}while( > );}} > Input: "\n\n\n\n\n\n\n\n" > Type: debug_output Hardness: 65 // Demo problem // Pair of nested loops, 2 variables, 1 variable input before inner loop and output after, // other variable input and output in inner loop, conditions are > and >= # 583 PostTest.Nested.Independent ? PostTest.Condition.Relational > [,,] {(){;; do{>>;do{>>;}while( != );<<;}while( == );}} > Input: "\n\n\n\n\n\n\n\n" > Type: debug_output Hardness: 65 // // Demo problem // // Pair of nested loops, 2 variables, 1 variable input before inner loop and output after, // // other variable input and output in inner loop, conditions are > and >= // # 589 // PostTest.Nested.Independent // ? // PostTest.Condition.Relational // > // [,,] // {(){;; // >> ; // do{>>;do{>>;}while( != );<<;}while( == );}} // > // Input: "\n\n\n\n\n\n\n\n" // > // Type: debug_output // Hardness: 65 // THESE TEMPLATES CANNOT BE CONVERTED FROM DEPENDENT TO INDEPENDENT // - INSIDE LOOP ALWAYS ITERATES THE SAME, MAKING IT MEANINGLESS. // // Read in outside loop, print up to it in inside loop // # 580 // PostTest.Nested.Independent // ? // Condition.Boundary.Legal // > // [] // {(){;; // do{>>;<<;=; // do{<< ; = + 1;}while( < ); // }while( <= // Input: "\n\n\n\n" // > // Type: debug_output // Hardness: 55 // // // Read in outside loop, print down from it in inside loop // # 581 // PostTest.Nested.Independent // ? // Condition.Boundary.Legal // > // [] // {(){;; // do{>>;<<;=; // do{<< ; = - 1;}while( > ); // }while( >= // Input: "\n\n\n\n" // > // Type: debug_output // Hardness: 55 // // # 582 // PostTest.Nested.Independent // ? // Condition.Boundary.Legal // > // [,,] // {(){;; // do{>>;<<;=; // do{<< ; = + ;}while( <= ); // }while( < // Input: "\n\n\n\n" // > // Type: debug_output // Hardness: 55 // // # 583 // PostTest.Nested.Independent // ? // Condition.Boundary.Legal // > // [,] // {(){;; // do{>>;<<;=; // do{<< ; = - ;}while( >= ); // }while( > // Input: "\n\n\n\n" // > // Type: debug_output // Hardness: 55 // ------------------ Parsons Puzzles -------------------------------------------------------- // DESIGN PRINCIPLES: // All about input validation // Combination of && and || conditions // Learning objectives: // PostTest.Parsons.Single - 2000 (TO DO) // PostTest.Parsons.Multiple.Independent - 2025 (TO DO) // PostTest.Parsons.Multiple.Dependent - 2050 (TO DO) // PostTest.Parsons.Nested.Independent - 2075 // PostTest.Parsons.Nested.Dependent - 2100 // -------------------------------------------------------------------------------------------- // PostTest.Parsons.Single - 2000 // Alternates && with || // Used DeMorgan's to simplify && expression to get or // age: 1-120 # 2000 PostTest.Parsons.Single > "It reads and validates the age of a person (1-120)." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter the age (1-120)"; >> ; } while( !( >= 1 && <= 120 ) ); /* Print the age of the person */ << ; }} > Type: parsons Hardness: 20 // positive even number # 2001 PostTest.Parsons.Single > "It reads and validates a positive even number." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter a positive even number"; >> ; } while( <= 0 || % 2 != 0 ); /* Print the positive even number */ << ; }} > Type: parsons Hardness: 20 // pretest # 2002 PostTest.Parsons.Single > "It reads and validates the input of month (1-12)." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter the month (1-12)"; >> ; } while( !( >= 1 && <= 12 ) ); /* Print the month */ << ; }} > Type: parsons Hardness: 20 // temperature: -140-140 # 2003 PostTest.Parsons.Single > "It reads and validates the temperature of a city (-140 to 140)." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter the temperature (-140 to 140)"; >> ; } while( < -140 || > 140 ); /* Print the temperature of the city */ << ; }} > Type: parsons Hardness: 20 // angle: 0 - 359 # 2004 PostTest.Parsons.Single > "It reads and validates the heading of a plane (0 to 359)." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter the heading angle (0 to 359)"; >> ; } while( !( >= 0 && <= 359 ) ); /* Print the heading of the plane */ << ; }} > Type: parsons Hardness: 20 // DemoParsons // ph input # 2005 PostTest.Parsons.Single > "It reads and validates the pH of a solution (1 to 14)." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter the pH of the solution (1 to 14)"; >> ; } while( < 1 || > 14 ); /* Print the pH of the solution */ << ; }} > Type: parsons Hardness: 20 // posttest // grade 1-100 # 2006 PostTest.Parsons.Single > "It reads and validates the grade on a test (0 to 100)." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter the grade (0 to 100)"; >> ; } while( !( >= 0 && <= 100 ) ); /* Print the grade on the test */ << ; }} > Type: parsons Hardness: 20 // credits 1-20 in a semester. # 2007 PostTest.Parsons.Single > "It reads and validates the number of credits taken in a semester (1 to 20)." {(){ /* Declare */ ; /* Read and validate */ do{ << "Enter the credits taken in the semester (1 to 20)"; >> ; } while( < 1 || > 20 ); /* Print the credits taken in the semester */ << ; }} > Type: parsons Hardness: 20 // gpa: 0-4.0 // percentage: 0-100 // probability: 0 - 1.0 // -------------------------------------------------------------------------------------------- // PostTest.Parsons.Multiple.Independent - 2025 // PROBLEM: For char input, cannot print the input at the end without using a selection statement! // time zone: e, c, m, p - plus time in military hour # 2025 PostTest.Parsons.Multiple.Independent > "It reads the hour (0-23), followed by the time zone (e for eastern, c for central, m for mountain and p for pacific) and validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate */ do{ << "Enter the hour (0-23)"; >> ; } while( !( >= 0 && <= 23 ) ); /* Read and validate */ do{ << "Enter the timeZone - (e)astern, (c)entral, (m)ountain or (p)acific"; >> ; } while( !( 'e' == || 'c' == || 'm' == || 'p' == ) ); }} > Type: parsons Hardness: 20 // DemoParsons // card face followed by suit # 2026 PostTest.Parsons.Multiple.Independent > "It reads the face (1-13) and the suit (c for clubs, d for diamonds, h for hearts and s for spades) of a card and validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate */ do{ << "Enter the face of the card (1-13)"; >> ; } while( < 1 || > 13 ); /* Read and validate */ do{ << "Enter the suit - (c)lubs, (d)iamonds, (h)earts or (s)pades"; >> ; } while( 'c' != && 'd' != && 'h' != && 's' != ); }} > Type: parsons Hardness: 20 // direction: north east west south plus speed of wind? # 2027 PostTest.Parsons.Multiple.Independent > "It reads the speed of wind (1-39 mph) and its direction (n for north, e for east, w for west and s for south). It validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate */ do{ << "Enter the speed of wind (1-39)"; >> ; } while( !( >= 1 && <= 39 ) ); /* Read and validate */ do{ << "Enter the direction - (n)orth, (e)ast, (w)est or (s)outh"; >> ; } while( 'n' != && 'e' != && 'w' != && 's' != ); }} > Type: parsons Hardness: 20 // pretest // Reads the type of car and the number of days of rental # 2028 PostTest.Parsons.Multiple.Independent > "It reads the type of rental car (e for economy, l for luxury, m for mid-size and s for SUV) and the number of days of rental (1-30) and validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate */ do{ << "Enter rental type - (e)conomy, (l)uxury, (m)id-size or (s)uv"; >> ; } while( !( 'e' == || 'l' == || 'm' == || 's' == ) ); /* Read and validate */ do{ << "Enter number of rental days (1-30)"; >> ; } while( < 1 || > 30 ); }} > Type: parsons Hardness: 20 // height and weight of a person # 2029 PostTest.Parsons.Multiple.Independent > "It reads the height in inches (12 - 90) and weight in pounds (1 - 400) of a person and validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate */ do{ << "Enter the height in inches (12 - 90)"; >> ; } while( !( >= 12 && <= 90 ) ); /* Read and validate */ do{ << "Enter the weight in pounds (1 - 400)"; >> ; } while( < 1 || > 400 ); }} > Type: parsons Hardness: 20 // Size of an envelope: length and width # 2030 PostTest.Parsons.Multiple.Independent > "It reads the length (3 - 15) and width (4 - 18) of a mailing envelope and validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate */ do{ << "Enter the length in inches (3 - 15)"; >> ; } while( < 3 || > 15 ); /* Read and validate */ do{ << "Enter the width in inches (4 - 18)"; >> ; } while( !( >= 4 && <= 18 ) ); }} > Type: parsons Hardness: 20 / posttest // Reads the type of hotel room and the number of days of rental # 2031 PostTest.Parsons.Multiple.Independent > "It reads the type of hotel room (s for single, d for double, e for efficiency, and t for suite) and the number of days of rental (1-30) and validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate */ do{ << "Enter room type - (s)ingle, (d)ouble, (e)fficiency or sui(t)e"; >> ; } while( 's' != && 'd' != && 'e' != && 't' != ); /* Read and validate */ do{ << "Enter number of days rented (1-30)"; >> ; } while( ! ( >= 1 && <= 30 ) ); }} > Type: parsons Hardness: 20 // Type of mattress - single, double, twin, queen, king // Reads the type of fence and the number of feet of fencing needed // Reads the type of TV programming and its duration (30/60/90/120) // hour and minute // letter grade: a, b, c, d, f - plus extra credit (1-10)? // -------------------------------------------------------------------------------------------- // PostTest.Parsons.Multiple.Dependent - 2050 // start time followed by end time of event # 2050 PostTest.Parsons.Multiple.Dependent > "It reads the start hour and end hour of an event in military time (0-23). It validates both inputs. Note that the event begins and ends on the same day." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate and */ do{ << "Enter the start hour of the event (0-23)"; >> ; } while( !( >= 0 && <= 23 ) ); do{ << "Enter the end hour of the event (start hour - 23)"; >> ; } while( < || > 23 ); }} > Type: parsons Hardness: 20 // pretest // regular price followed by discounted price # 2051 PostTest.Parsons.Multiple.Dependent > "It reads the regular price and discounted price of an item. It validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate and */ do{ << "Enter the regular price of the item (greater than 0)"; >> ; } while( <= 0 ); do{ << "Enter the discounted price (less than regular price)"; >> ; } while( !( > 0 && < ) ); }} > Type: parsons Hardness: 20 // DemoParsons // ask for number of respondents followed by those who strongly agreed # 2052 PostTest.Parsons.Multiple.Dependent > "It reads the number of people who took a survey followed by those whose responses were positive. It validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate and */ do{ << "Enter the number of survey respondents (greater than 0)"; >> ; } while( !( > 0 ) ); do{ << "Enter the number of positive respondents (at most everyone)"; >> ; } while( <= 0 || > ); }} > Type: parsons Hardness: 20 // Number of stalls in a parking lot, followed by number of parked cars # 2053 PostTest.Parsons.Multiple.Dependent > "It reads the number of stalls in a parking lot followed by the number of parked cars. It validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate and */ do{ << "Enter the number of stalls in the parking lot (greater than 0)"; >> ; } while( <= 0 ); do{ << "Enter the number of parked cars (no more than stalls)"; >> ; } while( !( >= 0 && <= ) ); }} > Type: parsons Hardness: 20 // tare/unladen weight of a rail car, gross weight is laden weight, // net weight is the difference between the two # 2054 PostTest.Parsons.Multiple.Dependent > "It reads the tare (unladen) weight of a rail car followed by its laden weight in tons. It validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate and */ do{ << "Enter the tare (unladen) weight of the rail car (30 - 40 tons)"; >> ; } while( !( >= 30 && <= 40 ) ); do{ << "Enter the laden weight of the rail car (tare weight - 93 tons)"; >> ; } while( < || > 93 ); }} > Type: parsons Hardness: 20 // age and number of years driving (age - 16) # 2055 PostTest.Parsons.Multiple.Dependent > "It reads the age of the driver (16-120) followed by the number of years the driver has had driver's license. It validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate and */ do{ << "Enter the age of the driver (16-120)"; >> ; } while( < 16 || > 120 ); do{ << "Enter the years the driver has had a license (0 to age - 16)"; >> ; } while( ! ( >= 0 && <= - 16 ) ); }} > Type: parsons Hardness: 20 // posttest // gross profit and net profit # 2056 PostTest.Parsons.Multiple.Dependent > "It reads the gross profit and net profit of a company. It validates both inputs." {(){ /* Declare */ ; /* Declare */ ; /* Read and validate and */ do{ << "Enter the gross profit (0 or more)"; >> ; } while( < 0 ); do{ << "Enter the net profit (at most gross profit)"; >> ; } while( < 0 || > ) ); }} > Type: parsons Hardness: 20 // number of students in a course, number who took a test // max score, followed by student's score // number of rooms in a museum followed by number of rooms dedicated to modern art // start day followed by end day of event // -------------------------------------------------------------------------------------------- // PostTest.Parsons.Nested.Independent - 2075 // -------------------------------------------------------------------------------------------- // PostTest.Parsons.Nested.Dependent - 2100 //--------------------------------------------------------------------------- // Templates here are for demonstration purposes // Included at the end so that regular practice does not pick up these templates // How to enter 2 outputs # 90 Demonstration > {(){=;<<;=;<<;}} > Type: debug_output Hardness: 10 // How to enter an error # 91 Demonstration > {(){;<<;}} > Type: debug_output Hardness: 10 // How to enter outputs when input is provided # 92 Demonstration > {(){;>>;<< ; >>; << ;}} > Input: "\n\n\n\n" > Type: debug_output Hardness: 10