Question
Write program in Java import java.util.Scanner; public class Lab7Program { public static void main(String[] args) { //1. Create a double array that can hold 10
Write program in Java
import java.util.Scanner;
public class Lab7Program { public static void main(String[] args) { //1. Create a double array that can hold 10 values //2. Invoke the outputArray method, the double array is the actual argument. //4. Initialize all array elements using random floating point numbers between 1.0 and 5.0, inclusive //5. Invoke the outputArray method to display the contents of the array //6. Set last element of the array with the value 5.5, use length to access last index. //7. Invoke the outputArray method to display the contents of the array //8. Allow user to input elements 2 through 6 through keyboard //9. Invoke the outputArray method to display the contents of the array //10. Compute the sum of all elements in the array //11. Display the sum you found in step #9 //12. Find the index of the smallest element in the array. //13. Display the index of the smallest element and the value of the // smallest element. //15. Invoke bubble sort method, the array is the actual argument. //16. Invoke the outputArray method, the array is the actual argument. //18. Invoke linearSearch method, search for value 5.5. Output a statement informing if the // search value was found or not. } // 3. Implement outputArray method that will display the contents of the array // on a single line, elements separated by spaces. // There should be an empty line in the output after the array elements. // 14. Implement bubble sort method here. The double type array is the formal parameter. // 17. Implement linearSearch method here. The double type array and search value are the formal parameters. }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started