Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java:9: '(' expected error

807598Nov 2 2006 — edited Nov 2 2006
could someone please tell me what the problemis and how to fix it

this is my code and i get this error
java:9: '(' expected


import java.io.*;
import java.text.DecimalFormat;

public class Grades2
{


public void Grades2
{
int ai1[] = new int[10];
float f = 0.0F;
float f1 = 0.0F;
String s1 = null;

BufferedReader bufferedreader = new BufferedReader(new FileReader("grades.dat"));
DecimalFormat decimalformat = new DecimalFormat("##0.00%");
System.out.println("Scores Read from the Input File");
System.out.println("-------------------------------");


s1 = bufferedreader.readLine();
int i = Integer.parseInt(s1.substring(0, s1.indexOf(" ")));
String s = s1.substring(s1.indexOf(" ") + 1);
s1 = null;

for(String s2 = bufferedreader.readLine(); s2 != null; s2 = bufferedreader.readLine())
{
System.out.println(s2);
if(s1 == null)
s1 = s2;
else
s1 = (new StringBuilder()).append(s1).append(" ").append(s2).toString();
}

System.out.println("");
String args1[] = s1.split(" ");
int ai[] = new int;
for(int j = 0; j < i; j++)
ai[j] = Integer.parseInt(args1[j]);

for(int k = 0; k < i; k++)
f = f += (float)ai[k] / (float)i;

for(int l = 0; l < i; l++)
f1 = (float)((double)f1 + Math.pow((float)ai[l] - f, 2D));

f1 = (float)Math.sqrt(f1 / (float)(i - 1));
for(int i1 = 0; i1 < 10; i1++)
ai1[i1] = 0;

for(int j1 = 0; j1 < i; j1++)
if(ai[j1] == 100)
ai1[ai[j1] / 10 - 1]++;
else
ai1[ai[j1] / 10]++;
}
}
public class output
{
public static void main(String args[]) throws IOExcetption
{
System.out.println(s);
for(int k1 = 0; k1 < s.length(); k1++)
System.out.print("-");

System.out.println("");
System.out.println((new StringBuilder()).append("Number of scores: ").append(i).toString());
System.out.println((new StringBuilder()).append("Mean Score: ").append(f).toString());
System.out.println((new StringBuilder()).append("Standard Deviation: ").append(f1).toString());
System.out.println("");
System.out.println("Histogram");
System.out.println("---------");
for(int l1 = 0; l1 < 10; l1++)
{
System.out.print((new StringBuilder()).append(l1 * 10).append("-").append((l1 + 1) * 10 - 1).append("\t").toString());
for(int i2 = 0; i2 < ai1[l1]; i2++)
System.out.print("*");

System.out.println((new StringBuilder()).append(" (").append(decimalformat.format((float)ai1[l1] / (float)i)).append(")").toString());
}

}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 30 2006
Added on Nov 2 2006
3 comments
211 views