0

basically, instead of the "(N1 + N2 + N3)" which is in the average method we need to call the sum method to the average method as the sum method returns a value = (N1 + N2 + N3). does anyone know how to call the sum method to the average method? The program still runs fine the way it is but the questions asks for it this way. thanks.

```
import javax.swing.JOptionPane;
public class maths_comp
{
public static void main(String[]args)
{
/*Declare variables*/
String Input, Input_2, Input_3;
double num_1, num_2, num_3;
Input = JOptionPane.showInputDialog("Enter Number 1:");
num_1 = Double.parseDouble(Input);
Input_2 = JOptionPane.showInputDialog("Enter Number 2:");
num_2 = Double.parseDouble(Input_2);
Input_3 = JOptionPane.showInputDialog("Enter Number 3:");
num_3 = Double.parseDouble(Input_3);
/*Display Answer*/
JOptionPane.showMessageDialog(null, "The Sum of the 3 numbers entered is: " + sum(num_1, num_2, num_3) + "\nThe Average of the 3 numbers entered is: " + average(num_1, num_2, num_3));
}
public static double sum(double N1, double N2, double N3)
{
double add_num;
add_num = N1 + N2 + N3;
return add_num;
}
public static double average(double N1, double N2, double N3)
{
double avg_num;
avg_num = (N1 + N2 + N3) / 3;
return avg_num;
}
}
```