Exercises
itemNumber
dollarAmount
:
itemNumber
and dollarAmount
slots.
Once you've created the soup, write code that finds how many items there are whose dollarAmount
is 17. Time your code to see how long it takes. Make improvements until you've got it as fast as possible.
Now write code that prints out each item whose dollarAmount
is 17 sorted by itemNumber
. How long does that take?
Add an index to the soup to speed up printing out each item whose dollarAmount
is 17 sorted by itemNumber
. How fast can you do it now?
Random
global function. Call it with Random(lowRange, highRange)
to return an integer between lowRange
and highRange
.Ticks
global function. It returns an integer that increases by one every 60th of a second.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996