|
|||
|
Why do I get this error?
Code: Java Code:
Exception in thread "main" java.util.UnknownFormatConversionException: Conversio n = '5' at java.util.Formatter.checkText (Formatter.java:2502) at java.util.Formatter.parse(Formatter.java:2484) at java.util.Formatter.format(Formatter.java:2413) at java.io.PrintStream.format(PrintStream.java:920) at java.io.PrintStream.printf(PrintStream.java:821) at Maclaurin1.main(Maclaurin1.java:55) Press any key to continue . . . |
|
|||
|
Post the code that trows the exception. It seems you use a printf call and the format you are passing is invalid (formats are in the form %something). If you post the code excerpt somebody might point you to the wrong format.
|
|
|||
|
Heres a snippet of the code:
Java Code:
public static void main(String[] args)
{
double x;
x = (Math.PI)/4;
double rad=0;
double result=0;
System.out.printf("Evaluate x = %1.0f",x);
result = sine_evaluate(x);
System.out.printf("%nSin Result = %5.15f",result);
result = cos_evaluate(x);
System.out.printf("%nCos Result = %5.15f%n",result);
rad=Math.toRadians(x);
result = Math.sin(rad);
System.out.printf("%nActual Sine Result = %5.15f%n",result);
result = Math.cos(rad);
System.out.printf("%nActual Cos Result = %5.15f%n",result);
}
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|