function not defined

Discussion in 'Java' started by cleys, Aug 23, 2004.

  1. cleys

    cleys Guest

    I am a VERY NEW programmer and having problems with the code below. I keep
    getting an error "function undefined" Can someone please help.

    {
    for (int month = 0; month <361; month++)
    System.out.println(month+" \t"+intPmtOut+" \t"+prinPmtOut+"
    \t"+prinBalOut);

    {
    if (Math.abs(month % 12) == 0)

    {
    if (month < 361)
    {
    System.out.println("Press Enter to continue");
    }
    try
    {
    int temp = System.in.read();
    }
    catch(Exception error)
    {
    }
    }
    {
    {
    if (month < 361)
    {
    System.out.println("\t Interest \t Principal \t Principal");
    System.out.println("Months \t Payment \t Payment \t Balance");
    System.out.println(month+" \t"+intPmtOut+" \t"+prinPmtOut+"
    \t"+prinBalOut);
    }
    }
    }
    }
    }
     
    cleys, Aug 23, 2004
    #1
    1. Advertising

  2. cleys

    Liz Guest

    "cleys" <> wrote in message
    news:...
    > I am a VERY NEW programmer and having problems with the code below. I

    keep
    > getting an error "function undefined" Can someone please help.
    >
    > {
    > for (int month = 0; month <361; month++)
    > System.out.println(month+" \t"+intPmtOut+" \t"+prinPmtOut+"
    > \t"+prinBalOut);
    >
    > {
    > if (Math.abs(month % 12) == 0)
    >
    > {
    > if (month < 361)
    > {
    > System.out.println("Press Enter to continue");
    > }
    > try
    > {
    > int temp = System.in.read();
    > }
    > catch(Exception error)
    > {
    > }
    > }
    > {
    > {
    > if (month < 361)
    > {
    > System.out.println("\t Interest \t Principal \t Principal");
    > System.out.println("Months \t Payment \t Payment \t Balance");
    > System.out.println(month+" \t"+intPmtOut+" \t"+prinPmtOut+"
    > \t"+prinBalOut);
    > }
    > }
    > }
    > }
    > }
    >

    Can you show the exact error message? Java Methods are not called functions.
     
    Liz, Aug 23, 2004
    #2
    1. Advertising

  3. cleys

    Paul Lutus Guest

    cleys wrote:

    > I am a VERY NEW programmer and having problems with the code below. I
    > keep
    > getting an error "function undefined" Can someone please help.


    We have the solution to your problem, but first you have to tell us what the
    problem is. Which line in your program is causing the error, and what is
    the exact text of the error message?

    --
    Paul Lutus
    http://www.arachnoid.com
     
    Paul Lutus, Aug 23, 2004
    #3
  4. "cleys" <> writes:

    > for (int month = 0; month <361; month++)
    > System.out.println(month+" \t"+intPmtOut+" \t"+prinPmtOut+"
    > \t"+prinBalOut);


    That is all your for statement does.

    > if (Math.abs(month % 12) == 0)


    You do not need math.abs() when dealing with integers you know
    beforehand to be positive.

    > if (month < 361)
    > {
    > System.out.println("Press Enter to continue");
    > }


    The if ends here, meaning...

    > try
    > {
    > int temp = System.in.read();
    > }
    > catch(Exception error)
    > {
    > }


    .... this code is executed every time, not every 12 months.

    You have a strange number of braces, leading me to conclue the error
    is in the code you did not post.
     
    Tor Iver Wilhelmsen, Aug 23, 2004
    #4
  5. On Sun, 22 Aug 2004 23:26:07 -0400, cleys wrote:

    > I am a VERY NEW programmer and having problems with the code below.


    1) <http://www.physci.org/codes/javafaq.jsp#xpost>

    > I keep getting an error "function undefined"


    2) <http://www.physci.org/codes/javafaq.jsp#exact>

    > Can someone please help.


    See 1)

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, Aug 23, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oodini
    Replies:
    1
    Views:
    1,776
    Keith Thompson
    Sep 27, 2005
  2. Angel Tsankov
    Replies:
    1
    Views:
    871
    Victor Bazarov
    Apr 5, 2006
  3. Replies:
    1
    Views:
    504
    Sion Arrowsmith
    Jul 10, 2008
  4. Keith Thompson

    Re: __STDC_IEC_559__ (defined or !defined ?)

    Keith Thompson, Aug 17, 2010, in forum: C Programming
    Replies:
    0
    Views:
    445
    Keith Thompson
    Aug 17, 2010
  5. Alok
    Replies:
    3
    Views:
    254
Loading...

Share This Page