Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Paldylan Styles Data: The input data for this program is given as two columns of numbers. All data will be entered from a file named

image text in transcribed
Paldylan Styles Data: The input data for this program is given as two columns of numbers. All data will be entered from a file named input.txt and all output will go to the screen. Assume there will not be more than 100 rows of data in the file. Sample Data Set: 7 23.56 16 88.12 10 75.1 Design a Java class with a main method that does the following: 1) Reads the data into two arrays of doubles, arrl and arr2, by invoking the method readData. with both arrays as parameters. The return value from readData should be stored in an integer variable num 2) Modifies all of the values in the arr2 array by invoking the method changeArray, passing both arrays and num as parameters. 3) Sort arrl and arr2 separately by invoking the method sortArray twice - once for arri and once for arr2 4) Prints the values in both arrays to the screen in two columns as shown below with a header and the numbers right aligned arri arr2 7.00 164.92 10.00 751.00 16.00 1409.92 Method Details: The readData method reads two doubles values from the input file. The first value of each line is stored in arrone, and the second value is stored in arrTwo. For example, in the Sample Data above, 7 would go into arrone[0] and 23.56 would go into arrTwo[0]. This is repeated until there are no more values in the file. Parameters: arrone - an array of doubles for storing the 1st value read in per row arrTwo - an array of doubles for storing the 2nd value read in perrow Returns num- an integer representing the number of rows that were read in

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions