Question: please include comments & send to file if needed. thank u! It is a java class using eclipse Write a complete program to do the

please include comments & send to file if needed. thank u!
 please include comments & send to file if needed. thank u!
It is a java class using eclipse

Write a complete program to do the following: (a) Write a method called readData() which receives two parameters, an array of integers called vals, which is initially uninitialized, and a reference to an output file. The method reads integers from an input file until it reaches EOF, storing the data values in the array vals. The method counts how many integers were read into the array. The method prints the data values read in and the count to an output file. The method returns the filled-in array and the total number of data values read in. (b) Write a method called countZeros() which receives two parameters, an integer n and an array vals. The method counts and retums how many of the first n elements of the vals array are 0. For example, if the array holds 66 0 -4 0 4 31 with n= 6, it has two 0 values. (c) Write a method called append() which reads in several new values into an array, appending them at the end of the array. The method receives the same two parameters as countZeros(). As a result, it must change both the array and the value of n.The method returns the updated array as well as the new total number of data values stored within the array. For example, Assume the array initially holds 66 0 -4 0 4 31 with n= 6; after the method call, the array might hold 66 0 -4 0 4 31 22 0 49 with n= 9. (Make sure that several new 0 values are added to the array.) (d) Write a main program which calls these methods. First, the main program calls read Data() to read a set of data into an array called numbers, which contains no more than 100 integers. The number of elements actually read is returned by the method and stored in a variable called size. Then, the main program calls the method countZeros() to find out how many of the size array elements are 0. The main program prints this value to the output file. Next, the main program calls append) to modify the numbers array and the value of size. The append() method reads in new values from a file until input failure, adding the new values to the array and incrementing the number of values stored within the array. The new values in the array and new total count are printed (in either the main program or the method) to the output file. Finally, the main program calls the method countZeros) again to determine how many elements in the new array are 0 and prints the result to the output file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!