alice-teacher Help Needed: Alice 2.4 Clock Project

Nichols, Denise dnichols at yorkcatholic.org
Mon Oct 24 15:50:08 EDT 2016


I am using the *Alice in Action* textbook written by Joel Adams.  In
Chapter 4 Flow Control, there is a programming project that my class and I
just cannot figure out.  I have the solution file, but we are not sure how
it was coded.  Does anyone have any suggestions?

Here is the directions from the textbook:

Programming Project 4.10
>From the Alice Gallery, choose a clock class that has subparts for the
minute and hour hands.

a. Build a clock method named *run ( )* that moves the minute and hour
hands realistically (that is, each time the minute hand compeltes a
rotation, the hour hand should advance 1 hour). Define a parameter named
*speedUp* that controls the duration of the hand movements, such that* run
(0) *will make the clock run at normal speed, *run (60)* will make the
clock run at 60 times its normal speed, run* (3600) *will make the clock
run at 3600 its normal speed, and so on.

b. Build a clock method *setTime(h, m)* that sets the clock's time to *h:m*
(*m* minutes after hour *h*).

c. Build three functions for your clock: one that returns its current time
(as a *String*), one that returns its current hours value (as a *Number*),
and one that returns its current minutes value (as a *Number*).

d. Build a clock method *setAlarm (h, m) *that lets you set the clock's
alarm to *h:m.*  Then modify your *run( ) *method so that when the clock's
current time is equal to *m* minutes after hour *h*, the clock plays a
sound.

Any ideas or suggestions would be appreciated.  Thanks so much!

Denise Nichols
*Computer Teacher*
*York Catholic High School*
*dnichols at yorkcatholic.org <dnichols at yorkcatholic.org>*
*717-846-8871*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20161024/21370767/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: programmingProject-10.a2w
Type: application/octet-stream
Size: 372634 bytes
Desc: not available
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20161024/21370767/attachment-0001.obj>


More information about the alice-teachers mailing list