Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

JAVA ARRAY MANIPULATION QUESTION:

make a method called manipulator that takes a double array as parameter and modifies it. The method will modify the array then print the array. The method must modify the existing array, it CAN NOT create a different array as the solution. The manipulator method will be a void method.

Remember: To get an average of 2 digits you add them together then divide by 2. Average of x and y = (x+y)/2

Modifications the method will do:

For every 2 consecutive elements in the array, both the elements are replaced by their average.

If the number of elements in an array is odd don't modify the last number of the array.

Basically, you find the average of 2 consecutive elements then replace both of the elements with that value.

Examples:

Array = {2.0,3.0} will be changed to {2.5,2.5} when passed to the manipulator method

Array = {2.0,3.0,45} will be changed to {2.5,2.5,45} when passed to the manipulator method

Array = {2.0,3.0,45,55} will be changed to {2.5,2.5,50,50} when passed to the manipulator method

Array = {2.0,3.0,45,55,9} will be changed to {2.5,2.5,50,50,9} when passed to the manipulator method

Remember if the amount of elements in the array is odd don't modify the last element.

Thanks in advance for help.

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
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
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education