AverageNumbers// This program will get an unknown number of numbers from the user// and determine their average. The user will quit by entering a -1import java.util.Scanner;// Scanner class used for getting user inputpublic class AverageNumbers{// The main method that begins execution of Java applicationpublic static void main(String args[]){// variable declarationsint number = 0; int total = 0; int count = 0; double average;// create Scanner to capture input from consoleScanner input = new Scanner(System.in);// get user input and calculate total sum while (number != -1) { System.out.print(Enter a number (-1 to quit): number = input.nextInt(); count = count + 1; total = total + number; } // Calculate the average average = total / count; // Display average and the samllest System.out.printf(The average is %.2fn average);