Write a program that reads a text file compacttxt and


Question: Please help me with the subsequent.

Question 1.Write a program that reads a text file (compact.txt) and stores the integers in an array.  Your instructor will provide this text file.

Question 2. Write a method compact that removes all zeroes from the array, leaving the order of the other elements unchanged.  All local variables within this function must be scalar.  In other words, you may not use a second array to solve the problem.

Question 3. Do not solve the problem by printing out only the non-zero values in the array.  The compactmethod must remove all zeros from the array.

Instructions:

Part 1. Print out the list both before and after removing the zeros.  For example:

Before:  0, 9, 7, 0, 0, 23, 4, 0

After:  9, 7, 23, 4

Part 2. Your program must use proper modular design and parameter passing.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write a program that reads a text file compacttxt and
Reference No:- TGS0945045

Expected delivery within 24 Hours