Re: need help, please
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 12/11/04
- Next message: Casey Hawthorne: "Re: need help, please"
- Previous message: Daniel T.: "Re: ADT"
- In reply to: slickn_sly: "need help, please"
- Next in thread: Casey Hawthorne: "Re: need help, please"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 11 Dec 2004 13:17:40 -0600
"slickn_sly" <bng_s@hotmail-dot-com.no-spam.invalid> wrote in message
news:41bafde4_5@Usenet.com...
> How would i go about implementing a program in java that would do the
> following,
>
> f(1) = 1; f(2) = 1; f(3) = 1; f(4) = 1; f(5) = 1;
>
> f(n) = f( n - 1 ) + 3 * f( n - 5 ) for all n > 5
>
> and display the results for n = 6, 7, 12, and 15
>
> if someone can start me off, i would really appreciate it cause i'm
> lost.
>
> I know how to calulate the values on paper, but implementing a program
> to do it is something else
>
*sniff sniff* Smells like homework. We don't do homework here. If you bring
some code to us, we'll be happy to help you straighten it out and figure out
whatever problems you run into. That said, if you can figure it out on
paper, you should be able to code it. Just break it down into the simplest
steps you can. For example, the first thing you might notice is that you
have one set of conditions for n <= 5 and another for n > 5. That's an if
statement if I've ever seen one:
if (n <= 5) {
...
} else {
...
}
Or if you prefer:
if (n > 5) {
...
} else {
...
}
That's your first "rule" governing the problem. Just break it down more from
there and fill in what you need. See http://www.physci.org/codes/sscce.jsp
for tips on posting your code to the ng for help.
Finally, please post to comp.lang.java.help in the future. This group is
deprecated.
- Next message: Casey Hawthorne: "Re: need help, please"
- Previous message: Daniel T.: "Re: ADT"
- In reply to: slickn_sly: "need help, please"
- Next in thread: Casey Hawthorne: "Re: need help, please"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|