1) Is there any errors? 2) Modify this program so that is also gives us: (a) num
ID: 646782 • Letter: 1
Question
1) Is there any errors?
2) Modify this program so that is also gives us:
(a) number of grades >= 90
(b) number of grades >= 80 and less than 90
(c) number of grades >= 70 and less than 80
(d) number of grades >= 60 and less than 70
(e) number of grades >= 50 and less than 60
(f) number of grades >= 40 and less than 50
..... etc
import java.util.Scanner;
public class Lab7
{
public static void main(String args [])
{
int i, sum, n, grade;
double avg;
sum=0;
System.out.println("enter number of students:");
n=input.nextInt();
for (i=1; i<=n; i++) {
System.out.print("enter a grade:");
grade=input.nextInt();
sum=sum+grade;
}
avg=(double) sum/n;
System.out.println("average is: " + avg);
}
}
Explanation / Answer
two errors.
n = input.nextInt();
grade = input.nextInt()
cannot find symbol
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.