Also eclipse gibt mit folgende Fehler aus:
Syntax error, insert "}" to complete SwitchBlock Firsteclipse.java Exercise 6 WS0405 line 169
Syntax error on token "}", delete this token Firsteclipse.java Exercise 6 WS0405 line 115
Ich bekomme es nicht hin, den Fehler zu finde. :?:
Kann mir mal jemand helfen?
so long,Nixblicker
Syntax error, insert "}" to complete SwitchBlock Firsteclipse.java Exercise 6 WS0405 line 169
Syntax error on token "}", delete this token Firsteclipse.java Exercise 6 WS0405 line 115
Ich bekomme es nicht hin, den Fehler zu finde. :?:
Kann mir mal jemand helfen?
Code:
public class Temperature
{
public static double getMin(double airTemp[], int days)
{
double minValue = airTemp[0];
minValue = airTemp[0];
for(int i= 0; i<days;i++)
{
if(airTemp[i] < minValue){
minValue = airTemp[i];
}
}
return minValue;
}
public static double getMax(double airTemp[], int days)
{
double maxValue = airTemp[0];
for(int i= 0; i<days;i++)
{
if(airTemp[i] > maxValue){
maxValue = airTemp[i];
}
}
return maxValue;
}
public static double getMean(double airTemp[], int days)
{
double meanValue = airTemp[0];
double sum = 0.0;
for(int i= 0; i<days;i++)
{
sum= sum + airTemp[i];
}
meanValue= sum /days;
return meanValue ;
}
public static void main(String [] args){
int month = Integer.parseInt(args[0]);
switch(month)
{case 7:
{BufferedReader br;
String line;
String token;
double temp;
int i=0;
try{
br = new BufferedReader (new FileReader("july.txt"));
line = br.readline();
StringTokenizer tokens = new StringTokenizer (line);
int count = tokens.countTokens();
double[] tempvector = new double[count];
while (tokens.hasmoretokens())
{
token = tokens.nextToken();
temp=Double.valueOf(token).doubleValue();
System.out.println("temp = " +temp);
tempvector[i]=temp;
i++;
double meanValue = mean (tempvector.length, tempvector);
double minValue = min (tempvector.length, tempvector);
double maxValue = max (tempvector.length, tempvector);
if (i==31)
{
System.out.println("minValue : " + minValue );
System.out.println("maxvalue : " + maxValue);
System.out.println("meanValue : " + meanValue );
}
}
br.close();
}
catch (FileNotFoundException e) {
System.out.println(e);
}
catch (IOException e) {
System.out.println(e);
}
}
break;
}
case 11:
{BufferedReader br;
String line;
String token;
double temp;
int i=0;
try
{
br = new BufferedReader (new FileReader("nov.txt"));
line = br.readline();
StringTokenizer tokens = new StringTokenizer (line);
int count = tokens.countTokens();
double[] tempvector = new double[count];
while (tokens.hasmoretokens())
{
token = tokens.nextToken();
temp=Double.valueOf(token).doubleValue();
tempvector[i]=temp;
i++;
double meanValue = mean (tempvector.length, tempvector);
double minValue = min (tempvector.length, tempvector);
double maxValue = max (tempvector.length, tempvector);
if (i==30)
{
System.out.println("minValue : " + minValue );
System.out.println("maxvalue : " + maxValue);
System.out.println("meanValue : " + meanValue );
}
}
br.close();
}
catch (FileNotFoundException e) {
System.out.println(e);
}
catch (IOException e) {
System.out.println(e);
}
break;
}
default:
{System.out.println("Hey, that not july or november! dude!");
}
}
}
so long,Nixblicker