System.out.print("The ");
System.out.print(adjective1);
System.out.print(" ");
newF for the next Fibonacci number, pF for
the previous Fibonacci number, ppF for the previous
previous Fibonacci number. Express that rule by an assignment statement
in Java: newF = ppF + pF; After this assignment statement
commands the computer to compute the next Fibonacci number and store it
in newF, the next two statements will change the values so
newF = ppF + pF; will make the computer compute the next
one after that. Here are the next two statements:
ppF = pF;
pF = newF;
ppF, pF and newF.
Put 1 in the ppF box and 1 in the pF box
and leave the newF box empty. Write step-by-step the
changes in what's written in the boxes when the following group of
3 statements is executed repeatedly, 10 times:
newF = ppF + pF;
ppF = pF;
pF = newF;
Do this on paper and bring the paper into class.
UA Library - Electronic Databases - Guide To Computing Literature - Code Review Search - Meyer's 2008 article
| Seth Chaiken, instructor |
|
||
| Course Times Attend the 3 Class Meetings plus one Lab per week. |
|