Class methods

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Class methods

Martin Patrick
Hi
     I am very new to programming and would like to ask if any of you guys
out there can help me with the course that I am studying,

I need to create a class method which will check that it is an integer and
(this is by the way a subclass of date)a ValidMonth:

I just cant seem to get to grips with this part of the course:-(

Someone please help........


Reply | Threaded
Open this post in threaded view
|

Re: Class methods

Mike-2
"Martin Patrick" <[hidden email]> wrote in message
news:9duua8$j7c$[hidden email]...

> Hi
>      I am very new to programming and would like to ask if any of you guys
> out there can help me with the course that I am studying,
>
> I need to create a class method which will check that it is an integer and
> (this is by the way a subclass of date)a ValidMonth:
>
> I just cant seem to get to grips with this part of the course:-(
>
> Someone please help........
>
Try This
validMonth: aNumber
 "This method checks that its argument is both an integer and a valid month
index. The method should answer true if its argument is both an integer and
a valid month index,otherwise the method should answer with false."


 ^(aNumber isInteger)&(aNumber >=1)&(aNumber<=12)


Reply | Threaded
Open this post in threaded view
|

Re: Class methods

Richard A. Harmon
In reply to this post by Martin Patrick
On Wed, 16 May 2001 23:18:24 +0100, "Martin Patrick"
<[hidden email]> wrote:

>Hi
>     I am very new to programming and would like to ask if any of you guys
>out there can help me with the course that I am studying,
>
>I need to create a class method which will check that it is an integer and
>(this is by the way a subclass of date)a ValidMonth:
>
>I just cant seem to get to grips with this part of the course:-(
>
>Someone please help........
>
>

Take a look at Object >>#isKindOf: (read and heed method comment), and
Date class >>#readMonthFrom:.

If this doesn't give you enough to figure it out or at least get
started, post follow up questions.

Welcome to Smalltalk.


--
Richard A. Harmon          "The only good zombie is a dead zombie"
[hidden email]           E. G. McCarthy


Reply | Threaded
Open this post in threaded view
|

Re: Class methods

paul baird
In reply to this post by Martin Patrick
That wouldn't be M206 would it ?

If so your TMA is way late !

"Martin Patrick" <[hidden email]> wrote in message
news:9duua8$j7c$[hidden email]...

> Hi
>      I am very new to programming and would like to ask if any of you guys
> out there can help me with the course that I am studying,
>
> I need to create a class method which will check that it is an integer and
> (this is by the way a subclass of date)a ValidMonth:
>
> I just cant seem to get to grips with this part of the course:-(
>
> Someone please help........
>
>