Course Solutions Uncategorized (Answered) : Question Make Following Java Program Work Program Demostrates Passing Arrays Arguments Met Q33126060

(Answered) : Question Make Following Java Program Work Program Demostrates Passing Arrays Arguments Met Q33126060

QUESTION: HOW DO I MAKE THE FOLLOWING JAVA PROGRAMWORK?

//this program demostrates passing arrays as an arguments to amethod and provides total

public class Arrays {

public static void main(String[] args) {

// TODO Auto-generated method stub

double [] values;

values = getArray();

for(double num : values)

System.out.print(num+ “”);

}

//getArray method to return a ref to an array of doubles

public static double getArray(double [] values)

{

double num total=0;

double[] array = {100.10, 90.50, 200.46, 115.00, 429.80, 123.45,19.49, 19.52, 19.77, 20.01};

return array;

for (double num : values) {

System.out.print(num + “”);

total += num;

}

System.out.println(“total:”+ total);

}

}

Expert Answer 


A solution will be send to your mail shortly . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post