Question: 3. (10 points) Simplify the following code segments if possible. Do not change the outcome of the code segments, even if it seems to be
3. (10 points) Simplify the following code segments if possible. Do not change the outcome of the code segments, even if it seems to be flawed semantically. You can NOT assume that calling, for example, turtles. increaseAge (1) three times has the same effect as calling turtleA.increaseAge (3) once. a) if (turtleA.age() 10 && turtleb.age() 20){ turtleB. increaseAge (1), ) b) while (!(turtleA.age() > 10 && turtleb.age() > 10)) { if (turtleA.age() 10) { turtleA.increaseAge(1; } else if (turtleb.age() > 10) { turtleb.increaseAge(1); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
