Hi I need some help with Java....i am using jGrasp. And i need a solution to this problem using the "for" loop.
It says:
1.1 input 5 numbers
1.2 Determine and output the largest number
1.3 Determine and output the sum of the numbers
1.4 Determine and output the average of the numbers
using simple java and scanner class....help would be greatly appreciated...

so far this is what i have...
import java.util.*;
public class Calculations
{
public static void main (String []args)
{
Scanner kb = new Scanner (System.in);
int largest=0;
int number=0;
int sum=0;
for (int i=1; i<=5; i++)
{
System.out.println("Enter number"+i);
number = kb.nextInt();
sum =number+i ;
double average = sum/5;
System.out.println("Sum "+sum);
System.out.println("Average "+average);
}
}
}
It says:
1.1 input 5 numbers
1.2 Determine and output the largest number
1.3 Determine and output the sum of the numbers
1.4 Determine and output the average of the numbers
using simple java and scanner class....help would be greatly appreciated...
so far this is what i have...
import java.util.*;
public class Calculations
{
public static void main (String []args)
{
Scanner kb = new Scanner (System.in);
int largest=0;
int number=0;
int sum=0;
for (int i=1; i<=5; i++)
{
System.out.println("Enter number"+i);
number = kb.nextInt();
sum =number+i ;
double average = sum/5;
System.out.println("Sum "+sum);
System.out.println("Average "+average);
}
}
}