I need to write a program that accepts eight int values representing student test scores from the user and then displays each of the values along with a message that indicates how far it is from the average.

Respuesta :

import java.util.Scanner; /*please note that i am writing this program in a way that seems as though it is at your level of experience. I am not using arrays to initialize the integers because from the looks of it, you arent at that level yet.*/public class answerBrainly{       public static Scanner in = new Scanner(System.in);    public static int input1;    public static int input2;    public static int input3;    public static int input4;    public static int input5;    public static int input6;    public static int input7;    public static int input8;    public static void main(String[]args){        System.out.println("Please enter in your first grade: ");        input1=in.nextInt();        System.out.println("Please enter in your second grade: ");        input2=in.nextInt();        System.out.println("Please enter in your third grade: ");        input3=in.nextInt();        System.out.println("Please enter in your fourth grade: ");        input4=in.nextInt();        System.out.println("Please enter in your fifth grade: ");        input5=in.nextInt();        System.out.println("Please enter in your sixth grade: ");        input6=in.nextInt();        System.out.println("Please enter in your seventh grade: ");        input7=in.nextInt();        System.out.println("Please enter in your eighth grade: ");        input8=in.nextInt();        int average = (input1+input2+input3+input4+input5+input6+input7+input8)/8;        System.out.println("Your average is: "+average);        int input1Calc=average-input1;        int input2Calc=average-input2;        int input3Calc=average-input3;        int input4Calc=average-input4;        int input5Calc=average-input5;        int input6Calc=average-input6;        int input7Calc=average-input7;        int input8Calc=average-input8;        System.out.println("Your first grade is "+input1Calc+" points away from the average");        System.out.println("Your second grade is "+input2Calc+" points away from the average");        System.out.println("Your third grade is "+input3Calc+" points away from the average");        System.out.println("Your fourth grade is "+input4Calc+" points away from the average");        System.out.println("Your fifth grade is "+input5Calc+" points away from the average");        System.out.println("Your sixth grade is "+input6Calc+" points away from the average");        System.out.println("Your seventh grade is "+input7Calc+" points away from the average");        System.out.println("Your eighth grade is "+input8Calc+" points away from the average");  }}