ISCL is a Intelligent Information Consulting System. Based on our knowledgebase, using AI tools such as CHATGPT, Customers could customize the information according to their needs, So as to achieve

How to Find the Average With Netbeans

2
    • 1). Start a new project. Select "Java," then select "Java Application." Give the project a name, such as "average." Create a main class called "Average."

    • 2). Write the code to find an average in the "Average" class:

      class Average{

      public static void main(String[] args){

      int[] counts = {1, 2, 3, 4, 5, 6, 7, 8, 9};
      int sum = 0;
      for (int i : counts){
      sum += i;
      } (Source 3)

      int average = sum / counts.length; //the sum of the numbers divided by the number of values

      System.out.println(average);

      }
      }

    • 3). Click the green execute arrow located in NetBean's top menu bar to run the program. The output will appear in the debugging window at the bottom of the NetBeans window.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.