I'm suppose to use Command-Line Arguments to take user input and than use an enhanced for loop to sum.
This is the error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from double to int
public class EnhanceForLoop {
public static void main(String[] args) {
// TODO Auto-generated method stub
if(args.length !=5)
System.out.println(" please enter no more than 4 numbers");
else
{
double sum;
double arrayLength = Double.parseDouble(args[0]);
double [] myArray = new double [ arrayLength ];
double value = Double.parseDouble((args[1]));
double counter = Double.parseDouble((args[2]));
for(double num: myArray)
sum += num;
System.out.printf("The sum is %f ", sum);
}
}
}