I'm trying to write a Java application that will read five double values and find the total, average, minimum and maximum of the values entered. For some reasons after trying to find what wrong with it it's still not building. I'd appreciate someone's expertise on the matter.
import javax.swing.JOptionPane;
class minmax {
/** Main Method */
public static void main(String[] args){
final int TOTAL_NUMBERS = 5;
int[] numbers = new int[5,10, 15, 20, 25,];
// Read all numbers
for (int i =0; i < numbers.length;i++) {
String numString = JOptionPane.showInputDialog(null,
"Enter a value:",
"Input", JOptionPane.QUESTION_MESSAGE);
// Find the largest
int max = numbers[0];
for (int i = 1; i < numbers.length; i++) {
if (max < numbers[i])
max = numbers[i];
}
// Find the smallest
int min = numbers[0];
for (int i = 1; i > numbers.length; i++) {
if (min > numbers[i])
min = numbers[i];
}
//Get average
double getAverage = Double.parseDouble(doubleString);
return (value A + value B + value C + value D + valueE) / 5;
//Determine the total of the five values
double determinetotal = Double.parseDouble(doubleString);
return (value A + value B + value C + value D + value E);
// Prepare the results
String output = "The values are ";
for (int i = 0; i < numbers. length; i++0 {
output += numbers[i] + " ";
}
output += "\nThe largest number is " + max;
output += "\nThe smallest number is " + min;
output += "\nThe average number is " + average;
output += "\nThe total number is " + total;
// Display results
JOptionPane.showMessageDialog(null,output,
"Output", JOptionPane.INFORMATION_MESSAGE);
}
}