Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java. Please explains with comments. a. Write a program to reads numbers (double) from a file. The data type is double. Keep track of

In java. Please explains with comments.
image text in transcribed
image text in transcribed
a. Write a program to reads numbers (double) from a file. The data type is double. Keep track of how many numbers you read in and place the numbers into an array. Assume that there are no more than 100 numbers to read in. In all the methods that follow, the parameter int n represents the number of records read in step a (which may be less than 100) b. Write a method with the header double compute Avg int n, double1 array) that computes and returns the average of the numbers in the array c. Write a method with the header void compareToAvg (int n, double avg, double array) to compare each number in the array to the average and, in the method ,print each number in the array and the text above average, below average, equal the average next to the number as appropriate. d. Write a method void smallest(int n, double 1 array) that will print the smallest number and the position (from 0) in the array e. Write a method void largest(int n, double array) that will print the largest number and the position (from 0) in the array f. In main do the following i. ii, iii. iv. Call the method computeAvg and store the returned value in a variable named avg. Then print the value of avg. Next call the method compareToAyg Then call the method smallest Then call the method largest

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

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions