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

(Solved) : 1 Implement Following C Code Mips Assembly Language Use Ss0 Hold Variable Example Handle Q28643733 . . . .(Solved) : 1 Implement Following C Code Mips Assembly Language Use Ss0 Hold Variable Example Handle Q28643733 . . . .

<br/><img src="https://media.cheggcdn.com/media%2F2c6%2F2c691473-7f75-4765-9a2d-b3716971cec6%2Fimage" alt="1. Implement the following C-code in MIPS assembly language. Use Ss0 to hold the variable i. For this example, handle the stack pointer carefully using standard MIPS stack