I am trying to write a program that repeatedly asks the user to supply scores (out of 10) on a test.It needs to continue until a negative value is supplied. Values higher than 10 should be ignored. I also calculated the average of the inputs. After the scores have been inputted, i need to use a single array to produce a table that automatically fills the test scores and the number of occurrences of the certain test score.
I wanted it to look something like this:
Score | # of Occurrences  
    0   3    
    1   2
    2   4
    3   5 
    4   6
and so on.. P
I am a beginner and this is my first question, so i am sorry if i made a mistake in posting the question or something.
import java.io.*;
import java.util.*;
public class Tester1
{
public static void main()
{   
    Scanner kbReader= new Scanner (System.in);
    int score[] = new int [10];//idk what im doing with these two arrays
    int numofOcc []= new int [10];
    int counter=0;
    int sum=0;
    for (int i=0;i<10;i++)// Instead of i<10... how would i make it so that it continues until a negative value is entered.
    {
        System.out.println("Enter score out of 10");
        int input=kbReader.nextInt();
        if (input>10)
        {
            System.out.println("Score must be out of 10");
        }
        else if (input<0)
        {
            System.out.println("Score must be out of 10");
            break;
        }
        else 
        {
            counter++;
            sum+=input;
        }
    }
    System.out.println("The mean score is " +(sum/counter));
  }
}
 
     
     
     
    