Got this error : illegal start of expression (at line 18) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Got this error : illegal start of expression (at line 18)

public class DetermineScore{ public static void main (string[] args) { scanner input = new scanner (System.in); system.out.println("Enter Number of Student: "); int studentNumber = input.nextInt(); int[] score = new int[studentNumber]; char grade; System.out.println("Enter" + studentNumber + "score:"); for (int i = 0; i < scores.length; i++){ if(score[i] > best) best = scores[i]; } String output = ""; for (int i = 0; i< scores.length; i++) } if (scores[i] >= 90-100) grade = 'A'; else if (scores[i] >= 80-89) grade = 'B'; else if (scores[i] >= 70-79) grade = 'C'; else if (scores[i] >= 60-69) grade = 'D'; else if (scores[i] >= 0-59) grade = 'F'; System.out.println("sorry you have no part here, FAILED."); } }

31st Oct 2016, 5:44 AM
frhnims
1 Answer
0
for (int i = 0; i < scores.length; i++) } You need to put "{" instead of "}" Probably TYPO :D Another thing. Why you use if (scores[i] >= 90-100) i guess you want to check if the scores[i] is between 90 and 100. Propper way to do so is: if (scores[i] >= 90 && scores[i] <= 100) etc. 90-100 = -10 so you are checking if scores[i] is greater than or equal to -10. If that's what you wanted to do, than it is OK.
31st Oct 2016, 9:52 AM
Mladen Stupar
Mladen Stupar - avatar