ber n is prime by checking w found, n is not prime. A more efficient a 6.6 (Revi
ID: 3753945 • Letter: B
Question
ber n is prime by checking w found, n is not prime. A more efficient a 6.6 (Revise Listing pumbers less than or equal to Vn can divide n Rewrite Listing 4.14 to display the first 50 prime nun You need to use an array to store the prime numbers andut whether they are possible divisors for n venly. If not, n is m obers using this approsd tn can divide n evenly. If and 9 and displays the count for each number. (Hin * 10) to generat sy counts, to store the counts for the number of Os, Is, )Write a program that generates 100 random integer e a random integer between O and 9. Use an th.randon( 6.7(Couwnt single digits) array of ten i a ra Sections 6.6-6.8 6.8 Average an arrax) Write two overloaded methods that return the av array with the following headers: public static int average(int[] array) public static double average(double[] array) Write a test program that prompts the user to enter ten double values, invokes this method, and displays the average value. 6.9 Find the smallest element) Write a method that finds the smallest element in an array of double values using the following header: public static double min(double [] array) Write a test program that prompts the user to enter ten numbers, invokes this method to return the minimum value, and displays the minimum value. Here is a sample run of the program Enter ten numbers: 1.9 2.5 3.7 2 1.5 6 3 4 5 2tr The minimum number is: 1.5 6.10 Find the index of the smallest element) Write a method that returms smalest element in an array of integers. If the number of such elements is greater than 1, return the smallest index. Use the following public static int er exofSmallestElement (double[] arrayExplanation / Answer
6.9 Answer
6.10 Answer
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.