1) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants Title = "Dame"; vars friend : String; begin friend := tbA.text; tbR1.text := friend; tbR2.text := Title & " " & tbA.text ; end; 2) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars doNow : String; doLater : String; begin doNow := "Mow the Lawns"; doLater := doNow; tbR1.text := doNow; tbR2.text := doLater; waiter(10); doLater := "Trim the edges"; tbR1.text := doNow; tbR2.text := doLater; end; 3) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars rDuty, rChore : Duty ; begin beginTransaction; create rDuty; create rChore; rDuty.taskName := "Mow the Lawns"; rChore := rDuty; tbR1.text := rDuty.taskName; tbR2.text := rChore.taskName; waiter(10); rDuty.taskName := "Lawns all finished"; tbR1.text := rDuty.taskName; tbR2.text := rChore.taskName; abortTransaction; end; 4) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars rDuty, rChore : Duty ; begin beginTransaction; create rDuty; create rChore; rDuty.taskName := "Mow the Lawns"; // rChore := "Fred Smith"; // tbR1.text := rDuty.taskName; // tbR2.text := rChore.taskName; // waiter(10); // rDuty.taskName := "Lawns all finished"; // tbR1.text := rDuty.taskName; // tbR2.text := rChore.taskName; abortTransaction; end; 5) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars leng1, leng2 : Integer; begin leng1 := tbA.text.length ; leng2 := tbB.text.length ; tbR1.text := (leng1 + leng2).String; waiter(10); obAlpha.value := (leng1>leng2); waiter(10); tbR2.text := tbA.text & tbB.text; tbR3.text := tbB.text & " connect " & tbA.text; end; 6) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars begin tbR1.text := tbA.text.length.String; tbR2.text := "LENGTH of A"; waiter(20); tbR1.text := tbA.text & tbB.text & (tbA.text & tbB.text).length.String; tbR2.text := "JOIN A & B"; waiter(20); tbR1.text := tbA.text.pos("fred",1).String; tbR2.text := "POSITION of fred"; waiter(20); tbR1.text := tbA.text.trimBlanks; tbR2.text := "TRIMMED version of A"; waiter(20); tbR1.text := tbA.text.padBlanks(60); tbR2.text := "PADDED version of A"; waiter(20); tbR1.text := tbA.text.toUpper; tbR2.text := "UPPER CASE version of A"; end; 7) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants Buster = "The number of taskDescrs is "; vars begin tbR1.text := taskDescr[1].length.String; tbB.text := tbR2.text; tbR3.text := Buster & allTasks.size.String; end; 8) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars result : String; begin read result; tbR1.text := result; tbR2.text := app.random(1500).String; end; 9) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars begin if tbA.text.length > tbB.text.length then tbR1.text := "A longer than B"; endif; end; 10) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars begin if tbA.text.length > tbB.text.length then tbR1.text := "A longer than B"; else tbR1.text := "A is not longer than B"; endif; end; 11) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars begin if tbA.text.length > tbB.text.length then tbR1.text := "A longer than B"; elseif tbA.text.length = tbB.text.length then tbR1.text := "EQUAL"; else tbR1.text := "A shorter than B"; endif; end; 12) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars counter : Integer; begin counter := 1; while counter < 20 do counter := counter + 1; tbR1.text := "Counter is now: " & counter.String; waiter(8); endwhile; end; 13) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars counter : Integer; begin counter := 0; while not (counter > 20) do counter := counter + 1; tbR1.text := "Counter is now: " & counter.String; waiter(8); endwhile; end; 14) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars tk : Task; begin foreach tk in allTasks do tbR2.text := tk.taskName; waiter(8); endforeach; end; 15) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars j : Integer; begin foreach j in 5 to 105 step 3 do tbR1.text := j.String; waiter(10); endforeach; end; 16) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars j : Integer; begin j := 0; while j < 50 do tbA.text := j.String; waiter(5); j := j + 1; endwhile; j := 50; while j > 0 do tbB.text := j.String; waiter(5); j := j - 2; endwhile; end; 17) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars tk : Task; begin foreach tk in allTasks do : endTheLoop tbR2.text := tk.taskName; if tk.taskName = "Feed cat again" then break endTheLoop; endif; waiter(8); endforeach endTheLoop; end; 18) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars str : String; begin str := fetchForMe; if str.length > 4 then obAlpha.value := true; else obBeta.value := true; endif; end; // OR if statement could be written as: // obAlpha.value := (str.length>3); // obBeta.value := (str.length<=3); 19) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars str : String; begin str := tbA.text; tbR1.text := revlist(str); end; revlist(p : String) : String; vars f, strRes : String; begin if p.length <= 1 then return p; else f := p[1]; strRes := p[2:end]; return revlist (strRes) & f; endif; end; 20) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars today, strDate : Date; begin strDate := tbA.text.Date; if strDate > today then tbR3.text := strDate.String & " is later"; else tbR3.text := today.String & " is later"; endif; end 21) compute() updating; // a method for you to write your code into. // you may have to add constants or vars. constants vars today, strDate : Date; begin strDate := tbA.text.Date; if tbA.text.Date.isValid then tbR2.text := "It is " & (today > tbA.text.Date).String & " that " & today.String & " is later than " & strDate.String; else tbR2.text := "Not a valid date"; endif; end;