Getting an error and I'm a newbie
Here's the error I get:
C:\>javac project1.java
project1.java:25 cannot find symbol
symbol : class FunMath
location : class Project1
new FunMath();
1 error
Here's the java program:
package untitled1;
import java.io.*;
public class Project1 {
/**
* Program initialization
*/
public Project1() {
int ar[] = new int[25];
ReadFile("C:\\Temp.txt", ar);
sort(ar);
System.out.println("Minimum= " + ar[0]);
System.out.println("Maximum=" + ar[ar.length - 1]);
System.out.println("Mean= " + mean(ar));
System.out.println("Mode= " + modal(ar));
System.out.println("Median= " + median(ar));
System.out.println("Std Dev= " + stdDev(ar));
}
/**
* Main program
*
* @param args String[]
*/
public static void main(String args[]) {
new FunMath();
}
/**
* Calculate the mean
*
* @param ar int[]
* @return double
*/
public double mean(int ar[]) {
int sum = 0;
for (int i = 0; i < ar.length; i++) {
sum += ar;
}
return (sum / ar.length);
}
/**
* Calculate the mode/modal
*
* @param a int[]
* @return int
*/
public int modal(int a[]) {
int n;
int freq = 0;
int Mfreq = 0;
int Mn = a[0];
for (int i = 0; i < a.length; i++) {
n = a;
for (int j = 0; j < a.length; j++) {
if (a[j] == n) {
freq++;
}
}
if (freq > Mfreq) {
Mn = n;
}
}
return Mn;
}
/**
* Calculate the median
*
* @param a int[]
* @return int
*/
public int median(int a[]) {
if (a.length % 2 == 0) {
int x = a[a.length / 2];
int y = a[ (a.length + 2) / 2];
return (x + y) / 2;
}
else {
return a[ (a.length + 1) / 2];
}
}
/**
* Calculate Standard Deviation
*
* @param a int[]
* @return double
*/
public double stdDev(int a[]) {
int s2 = 0;
int s = 0;
for (int i = 0; i < a.length; i++) {
s2 += (a * a);
s += a;
}
return Math.sqrt( (s2 - (s * 2) / a.length) / (a.length - 1));
}
/**
* Sort integer array
*
* @param a int[]
*/
public void sort(int a[]) {
int tmp;
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a.length; j++) {
if (a[j] > a[j + 1]) {
tmp = a[j];
a[j] = a[j + 1];
a[j + 1] = tmp;
}
}
}
}
/**
* Read integer array from specified file
*
* @param filename String
* @param ar int[]
* @return int
*/
public int ReadFile(String filename, int ar[]) {
File infile = new File(filename);
int value, n = 0;
try {
BufferedReader reader = new BufferedReader(new FileReader(infile));
String line = null;
while ( (line = reader.readLine()) != null) {
value = Integer.parseInt(line);
ar[n++] = value;
}
return n;
}
catch (IOException e) {
System.err.println("Problem reading input file!");
System.exit(1);
}
return n;
}
}

