Answer:
import java.util.Scanner;
public class ANot {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n =0;
int sum=0;
while(n<=100){
System.out.println("enter the next score");
sum = sum+in.nextInt();
n++;
}
double average = sum/n;
if(average>90){
System.out.println("Record A");
}
else if(average>80 && average<90){
System.out.println("Record B");
}
else if(average>70 && average<80){
System.out.println("Record C");
}
else if(average>60 && average<70){
System.out.println("Record D");
}
else{
System.out.println("Record F");
}
}
}
Step-by-step explanation:
Using Java programming language:
- Prompt user to input the 100 scores.
- Use a while statement with the condition while(n<100) since n has been initialized to zero. Increment n after each iteration.
- create a sum variable outside the while loop and initialize to zero
- Add the value entered at each iteration to the sum variable
- average = sum/n
- Use multiple if/elseif and else statements to output what should be recorded according to the given rubic.