Hi everyone,
After making some additional modifcations it still not compiling due to the last bracket.
I decided to redo your program and it now compiles but try and make your program a bit easier to read next time as i find it a bit cluttered.
Here is your redone progra,
import javax.swing.JOptionPane;
class minmax
{
int[] numbers = {
5, 10, 15, 20, 25
}
;
int getLargest(int[] num1)
{
// Find the largest
int max = num1[0];
for (int i = 1; i < num1.length; i++)
{
if (max < num1[i])
{
max = num1[i];
}
}
return max;
}
int getSmallest(int[] num2)
{
int min = num2[0];
for (int i = 1; i > num2.length; i++)
{
if (min > num2[i])
{
min = num2[i];
}
}
return min;
}
int getTotal(int[] num3)
{
int Total = 0;
for(int i=0;i<num3.length;i++)
{
Total = num3[i] + Total;
}
return Total;
}
double getAverage(int[] num4)
{
int Total = getTotal(num4);
double Avg = (Total/num4.length);
return Avg;
}
void readValues()
{
String numString = null;
for (int i =0;i< numbers.length;i++)
{
numString = JOptionPane.showInputDialog(null,
"Enter a value:",
"Input", JOptionPane.QUESTION_MESSAGE);
numbers[i] = Integer.parseInt(numString);
}
}
void output()
{
//call the appropriate function and you are all set
}
public static void main(String[] args)
{
minmax minmax1 = new minmax();
minmax1.output();
}
}
I hope this has helped you
Yours Sincerely
Richard West
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10