Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I need your help quickly!
I have this small for loop and it says "Cannot find symbol i" or something, but I did defined it in the loop.
for(short i=0;i<pin.length;i++)
if (pin[i].getName().equals(x))
System.out.println("Όνομα"+"\t"+"Μήκος"+"\t"+"Πλάτος"+"\t"+"Εκτόπισμα"+"\t"+"Έτος Κατασκευής"+"\t"+"Μέγιστη Ταχύτητα"+"\t"+"Όνομα ιδιοκτήτη");
System.out.println("name"+"\t"+pin[i].getLength()+"\t"+pin[i].getWidth()+"\t"+pin[i].getDisplacement()+"\t"+pin[i].getYear()+"\t"+pin[i].getSpeed()+"\t"+pin[i].getOwners_name());
}
you need to add {} to define your scopes
for(short i=0;i<pin.length;i++) {
if (pin[i].getName().equals(x)) {
System.out.println("Όνομα"+"\t"+"Μήκος"+"\t"+"Πλάτος"+"\t"+"Εκτόπισμα"+"\t"+"Έτος Κατασκευής"+"\t"+"Μέγιστη Ταχύτητα"+"\t"+"Όνομα ιδιοκτήτη");
System.out.println("name"+"\t"+pin[i].getLength()+"\t"+pin[i].getWidth()+"\t"+pin[i].getDisplacement()+"\t"+pin[i].getYear()+"\t"+pin[i].getSpeed()+"\t"+pin[i].getOwners_name());
}
}
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
When i use the below code it is throwing me error
Hashtable htl = new Hashtable(int 50, float 0.90);
Error: Syntax error on token "int", delete this token
You don't place the types when calling a method.
Just replace with
Hashtable htl=new Hashtable(50, 0.90);
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I want to key in a value(int) as a parameter and make a loop from zero until it reaches that number.
Scanner s = new Scanner(System.in);
int m=0;
int a;
a=s.nextInt();
while(a<=10) {
System.out.println(m); m++;
}
while loop must be like this:
while(m<=a) {
...
}
In while condition you need to add m<=10 not a.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I tried compiling my code so I could then run it and test it, but it says that there is a semi-colon expected.
I tried deleting and re-inserting the semi-colon, but the error keeps appearing when I compile. The error is "GPACalculator.java:430: error: ';' expected"
if ((class71Honors.equals("Yes"))||(class71Honors.equals("Yes."))||(class71Honors.equals("yes"))||(class71Honors.equals("yes.")))
{
double class71GPA+=0.6;
}
I don't expect a printed output, I just want the code to compile because it's the only error I have at the moment. Thanks! (this is all java by the way)
This is invalid syntax.
double class71GPA+=0.6;
First you need to define and initialize your variable:
double class71GPA = 0;
And after that you can use it in statements. In your case:
class71GPA += 0.6;
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am getting wrong output while using java Math functions.
expected output = 4.32
present output= 4.30287105016515
double startHeight= 60.00;
double initaldistance=1000.00;
double speed=120;
startDistance=(initaldistance-1.688*speed);
startAngle = Math.toDegrees(Math.atan(startHeight/startDistance));
System.out.println(startAngle);
Your expected output is incorrect. The arithmetic expressed in the code in the question does indeed have a result near 4.30287.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I've been trying to calculate averages for parameters stored in ArrayList but always seem to receive 0 when calling my numberAverage class after adding new int objects to the ArrayList and I could really do with some help to point me in the right direction.
Thank you.
You did the reverse of what mean actually is. Use this:
double mean = ((double)aggregate / numberAverage.size());