answersLogoWhite

0


Best Answer

import java.util.*;

public class avg {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.print("How many numbers: ");

int amount = input.nextInt();

double [] numbers = new double[amount];

double count = 0;

double avg;

for(int i = 0; i < numbers.length; i++){

System.out.print("Number: ");

numbers[i] = input.nextDouble();

count += numbers[i];

}

avg = count / amount;

System.out.println(avg);

}

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you create java average calculator..any integer number.using netbeans or notepad plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you calculate averages in visual basic?

Dim average as doubleDim numberA as integer = 23Dim numberB as integer =2Dim numberC as integer = 27 'continue until you have enough numbersaverage = numberA + numberB + numberC '...average = average / 3 ' replace 3 with the amount of numbers used.


The average of 6 integers is exactly 6 If a seventh integer is added to 6 integers the average of the 7 integers is exactly 13 what is the seventh integer?

55


What is the integer of 15 yards?

15 is, itself, an average number.


Why isn't the atomic mass of most of the elements on the periodic table an integer and not a decimal?

Because of each elements many isotopes they the do not average out to a integer.


What is the average if 3 cubed and 5 squared?

3 cubed is 3^3=27 and 5 squared is 5^2=25. A cube of an integer is that integer multiplied by itself three times. A square of an integer is that integer multiplied by itself two times. The average of two numbers is those two numbers added together and divided by two. Any average is the numbers added together, then divided by the number of integers. Therefore, the average is (27+25)/2=52/2=26.


Java code to average and total a set of numbers?

The below method is written in the assumption that, the n numbers are sent as an ArrayList of Integer values. public void computeSumAndAvg(ArrayList lst){ Iterator itr = lst.iterator(); int sum = 0; float average = 0; int count = 0; while(itr.hasNext(){ Integer val = (Integer) itr.next(); sum = sum + val.intValue(); count++; } average = sum/count; System.out.println("Sum is: " + sum) ; System.out.println("Average is: " + average) ; }


If the average of 18 consecutive odd integer is 534 then least of these integers is?

517


Will the average of two integers always have an integer answer?

Take two integers 1 2 add them together 1+2=3 devide by the number of integers (2) to get the average 3/2= 1.5 Your answer is 1.5 and you need to ask yourself if 1.5 is an integer to find the answer to your question.


Is -2 is not an integer?

No, it is an integer.


What is the average integer between 25 and 41?

33. ( how i got it 25+41= 66; 66/2= 33)


How do you get the absolute value of positive integer?

The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.


Will the square of an integer always be an integer?

Yes, the square of an integer is always an integer.