Ok well, you could do it this way, but i prefer a more object-oriented approach. Basically, what i mean is that i would prefer to make a class in which i can construct a new object that calls for the 5 numbers, and there are methods in this class for doing each operation. If you want to get more sophisticated and practical, you can have it call for any amount of numbers (through use of arrays), but don't worry about that yet. So Ok, i'll set up the structure for you and see if you can figure out the method definitions.
public class MathData
{
private int a;
private int b;
private int c;
private int d;
private int e;
public MathData(int a1, int b1, int c1, int d1, int e1)
{
a = a1;
b = b1;
c = c1;
d = d1;
e = e1;
}
public int findSum()
{
//code goes here
}
public int findProduct()
{
//code goes here
}
public int findAverage()
{
//code goes here
}
}
Ok so i've set up the class for you. See if you can write the code for the methods.