A program that analyzes a set of numbers can be very useful. Create an Analysis application that prompts the user for numbers in the range 1 through 50, terminated by a sentinel, and then performs the following analysis on the numbers
Determine the average number
Determine the maximum number
Determine the range (maximum - minimum)
Displays a histogram that shows the numbers in each five-unit range.
--- Update ---
how do i go about solving this problem?
this is what i have so far:
import java.util.Scanner;
public class Arrays {
public static void main (String [] args){
Scanner scan = new Scanner (System.in);
int array [] = new int[0];
int num;
System.out.println("Enter a number between 1 - 50 inclusive OR -1 if u wish to end");
array = num.nextInt();
//loop with sentinel value
while( num != -1)
array[0]++;
// maximum value
int maximum;
for( num=0; num<=50; num++){
if (maximum< array[num]){
maximum= array[num];
}
}
// minimum value
int minimum;
for (num=0; num >=50; num++){
if(minimum>array[num]){
minimum=array [num];
}
}
// average
int average;
int sum;
for(num=0; num<=50;num++){
sum=sum+array[num];
}
average = sum/50;
int range;
range = maximum-minimum;
}
}