Please help me solve this with java  1-method called printArray that takes an array of double values and prints the array elements on the same line with one space between each two elements, then prints a new  line. 2.  A method called getRandomElement that takes an array of double numbers  and returns a random element from the array. 3. A method called shiftArray that takes a double value and an array of double  values. The method must shift the array in its place to the right, and insert the double  value at index 0. Note that this method must not create a new array, it must rotate the  array in its place. For example, if the passed array is 6.5, 2.1, 5.8, 1.5, 8.9 and the passed double value is  3.3, after invoking the method the array must become: 3.3, 6.5, 2.1, 5.8, 1.5 4. A method called occurrences that takes a double value and an array of doubles  as parameters, and returns the number of occurrences of the double value in the array. For example, if the double number 4.1 and the array {1.5, 4.1, 1.5, 2.3, 4.1, 4.1, 5.2}  are passed, the method must return the number 3. 5.  A method named findElement that takes a double number and an array of  double numbers as parameters and returns an array that includes the indices of all the  number occurrences in the array. This method must invoke the method occurrences to get how many times the value  appears in the array. For example, if the double number 4.1 and the array {1.5, 4.1, 1.5, 2.3, 4.1, 4.1, 5.2}  are passed, the method must return the array {1, 4, 5}. If the passed number does not occur in the array, the method must return an array of  zero elements.    6. A method called print2DArray, that takes a two-dimensional array of double  values, and prints its elements as a matrix of rows and columns. 7. A method called create2DArray that takes two integers, the first represents  the number of rows and the second represents the number of columns. It must return a  two-dimensional array of double values with the entered number of rows and columns filled with random double values between 0 and 10. 8. In your main method: - Declare, create, and initialize the following arrays of double values with the following  names:  list1: 3.5   6.5    1.5    6.5    6.5     8.5   5.5    1.5 list2: an array whose size and elements values are read from the user. - Print elements of the arrays list1 and list2 by invoking the printArray method. - Print a random element from list2 by invoking getRandomElement method. - Shift the array list1 three times to the right and fill the value 2.5 in the first three  indices by invoking the shiftArray method. - Print the indices of the value 6.5 in the array list1 by invoking the findElement method. - Create a two-dimensional array by invoking the create2DArray method then print it  to the console by invoking the print2DArray method.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please help me solve this with java 

1-method called printArray that takes an array of double values and prints the array
elements on the same line with one space between each two elements, then prints a new 
line.
2.  A method called getRandomElement that takes an array of double numbers 
and returns a random element from the array.
3. A method called shiftArray that takes a double value and an array of double 
values. The method must shift the array in its place to the right, and insert the double 
value at index 0. Note that this method must not create a new array, it must rotate the 
array in its place.
For example, if the passed array is 6.5, 2.1, 5.8, 1.5, 8.9 and the passed double value is 
3.3, after invoking the method the array must become:
3.3, 6.5, 2.1, 5.8, 1.5
4. A method called occurrences that takes a double value and an array of doubles 
as parameters, and returns the number of occurrences of the double value in the array.
For example, if the double number 4.1 and the array {1.5, 4.1, 1.5, 2.3, 4.1, 4.1, 5.2} 
are passed, the method must return the number 3.
5.  A method named findElement that takes a double number and an array of 
double numbers as parameters and returns an array that includes the indices of all the 
number occurrences in the array.
This method must invoke the method occurrences to get how many times the value 
appears in the array.
For example, if the double number 4.1 and the array {1.5, 4.1, 1.5, 2.3, 4.1, 4.1, 5.2} 
are passed, the method must return the array {1, 4, 5}.
If the passed number does not occur in the array, the method must return an array of 
zero elements.

   6. A method called print2DArray, that takes a two-dimensional array of double 
values, and prints its elements as a matrix of rows and columns.
7. A method called create2DArray that takes two integers, the first represents 
the number of rows and the second represents the number of columns. It must return a 
two-dimensional array of double values with the entered number of rows and columns
filled with random double values between 0 and 10.
8. In your main method:
- Declare, create, and initialize the following arrays of double values with the following 
names: 
list1:
3.5   6.5    1.5    6.5    6.5     8.5   5.5    1.5
list2: an array whose size and elements values are read from the user.
- Print elements of the arrays list1 and list2 by invoking the printArray method.
- Print a random element from list2 by invoking getRandomElement method.
- Shift the array list1 three times to the right and fill the value 2.5 in the first three 
indices by invoking the shiftArray method.
- Print the indices of the value 6.5 in the array list1 by invoking the findElement method.
- Create a two-dimensional array by invoking the create2DArray method then print it 
to the console by invoking the print2DArray method.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education