Re: need help, please

From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 12/11/04


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.



Relevant Pages

  • Re: Java compiler courses
    ... paralel Java class they were still struggling with inheritance, ... Then IMAO someone misfabricated the Java course. ... diagrams heaviliy to explain inheritance and virtual methods, ... and I assign somewhat difficult homework. ...
    (comp.compilers)
  • Re: PRINTING DIAMOND SHAPE WITH LOOPS!
    ... >> them to do your homework for you. ... instead trying to learn Java at your job. ... Thus Cid was right in saying that people will not write ... that all it teaches you is how to type in ready-made code. ...
    (comp.lang.java.programmer)
  • Re: Seaching word in text file using JAVA.
    ... > I have a problem on seaching word in text file using JAVA. ... > 1990 and imran.I also want to save word honda in static string name ... Also, if this is a homework assignment, I hope you're not expecting the ...
    (comp.lang.java.programmer)
  • Re: Help
    ... Or maybe that's what your assignment says? ... >>So, tyeanes, by all means convince me that this isn't homework. ... >you in a dream last night? ... How, exactly, is writing a java program to sum the cubes up to N going ...
    (comp.lang.java.help)
  • Re: whats the average age of programmers on here
    ... The question would then be why do you think they use .NET instead of Java? ... results translate to determining the reasons for your assumed age gap? ... *sniff sniff*, definate troll smell in the air. ... >> Alejandro Lapeyre ...
    (microsoft.public.dotnet.general)