Ask the user for an array size. Then receive this number of double values. Place
ID: 3631628 • Letter: A
Question
Ask the user for an array size. Then receive this
number of double values. Place numbers within an
array. Now randomly generate a number between 0
and 100. Indicate whether user’s inputs include this
number, and its index if included. You should
ii l t mplement andd use ththe ff ll i ollowing methth dod iin your
program.
/ method /*method findElement() findElement() check check whether whether the the number number “target target”
exists in the array “numbers”. If so, return the index of
“target”; otherwise return -1.*/
public static int findElement(double target, double[] numbers)
Explanation / Answer
Please rate :>) Check http://pastebin.com/3QFrDLRD for proper code with syntax highlighting and indentation. import java.util.Scanner; class NewProgram { public static void main(String[] args) { double[] numbers; int size; Scanner scanner = new Scanner(System.in); System.out.print("Enter the array size : "); size = scanner.nextInt(); numbers = new double[size]; for(int i=0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.