Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE MAKE ALL 6 OF THESE METHODS AS INSTRUCTED!!! Write a Java class with methods that perform various operations on an array of doubles. Follow

PLEASE MAKE ALL 6 OF THESE METHODS AS INSTRUCTED!!!

Write a Java class with methods that perform various operations on an array of doubles.

Follow the instructions carefully. In particular, write methods where directed; do not stuff main() with code that should be elsewhere.

Write a method that creates an array of ten doubles, initializes it with ten values taken from console input (ie, a Scanner from System.in), and returns a reference to the array.

Write a method that uses Math.sqrt() to find the square root of each value in an array of doubles and shows each result. This method should not change the values in the array.

Write a method that replaces any value exceeding 500 in an array of doubles with the value 500. This method should be void; in other words it should not return anything. Be sure you understand how array references are sent to methods.

Write a method that copies an array of doubles, replaces each value with its reciprocal (that is, replaces x with 1/x) and returns the new array. Be sure you understand the difference between copying an array and copying an array reference, or you will not do this part correctly.

Write a method that prints out all the values in an array of doubles

main() should call the input method, then send the array to the print method, then run each of the other methods, using the print method to print the current values after each method is done. After running the method that creates a new array, print out both the original array and the one returned by the method.

RULES

(Use Array Lists of capital-D Doubles instead of arrays of doubles.)

(In the method that takes user input, ask the user how many Doubles should be in the list, take input for that number of Doubles, and add the values to the list.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

11.7 Correlation Analysis Hypothesis Test for Correlation

Answered: 1 week ago