function not defined

C

cleys

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);
}
}
}
}
}
 
L

Liz

cleys said:
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.
 
P

Paul Lutus

cleys said:
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?
 
T

Tor Iver Wilhelmsen

cleys said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top