Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

. What is an expression in Alice? . Name at least 4 control structures you can u

ID: 641710 • Letter: #

Question

. What is an expression in Alice? . Name at least 4 control structures you can use in Alice. . Describe the process of stepwise refinement . Suppose you had three different methods that peformed the same action on three different objects. For example, say the first method caused a cow to walk in a circle, the second caused a kitty to walk in a circle, and the third caused a triceratops to walk in a circle. Describe how a parameter in your method definition could be used to reduce the amount of programming required by 2/3. . What are the four guidelines for creating class-level methods? You may be brief

Explanation / Answer

1)
All of the computer programming languages with which I am familiar consist of statements, which in turn, consist of expressions.
An expression is a specific combination of operators and operands, which evaluates to a particular result.
The operands can be variables, literals, or method calls that return a value.
2)if/else, repetition..i know only these two
3)definiton:A way of developing a computer program by first describing general functions, then breaking each function down into details which are refined in successive steps until the whole program is fully defined. Also called top-down design
A design is not concerned with the details of how a particular programming
language looks (called the syntax of the language). Instead, good design focuses on the logical steps
required to solve any particular problem.
Two common tools for design are pseudocode and flowcharts. Pseudocode somewhat resembles
programming code, except it uses plain English phrases instead of specific syntax. A flowchart is a
diagram that represents the logic for the solution to the problem.
Whether using pseudocode or flowcharts, a design usually starts with a very broad description of a
solution. As the design develops, you will refine the design to add additional steps, correct errors, and
continue to improve the detail in the design. This process is known as stepwise refinement.
For example, consider one of the classes from the People gallery in Alice. Suppose we want to have
a person walk in place (i.e., they step up and down, but don't move anywhere) as part of an exercise
routine. Our first attempt at a design (using pseudocode) might be very limited:
step up
step down
This is obviously inadequate, since we haven't even mentioned the left and right legs.
right leg up
left leg down
left leg up
right leg down
With Alice, we have previously used the concepts of Do together and Do in order. We don't often have
to specify Do in order (since that is the default behaviour), but Do together is important, and applies to
pseudocode as well.
Do together
left leg up
right leg down
Do together
right leg up
left leg down
Notice that our first block of code has the right leg moving down, which assumes it is already raised.
Similarly, at the end of the code, the right leg is left up.
right leg up
Do together
left leg up
right leg down
Do together
right leg up
left leg down
right leg down
From our experience with Alice, we know that animation can be quite complicated, and that there
aren't primitive methods to perform