Question: public static void execute(BufferedReader r, PrintWriter w) throws IOException, NumberFormatException { // TODO(student): Your code goes here. } in java please!!! Part 3. [10 marks]

public static void execute(BufferedReader r, PrintWriter w) throws IOException, NumberFormatException {
// TODO(student): Your code goes here.
}
in java please!!!
Part 3. [10 marks] Given a file where each line is a single (32-bit) positive integer, read in the lines of the file one at a time; output the lines that are divisible by the previous line, in reverse order. For example, if the input is 4 2 not divisible by the previous line 8 divisible by 2 , so we output 8 8 divisible by 8 , so we output 8 The output is therefore 8 8 Note the similarity to Part 1; they serve different purposes, so think about why the solution for one may not be the best for the other, and vice-versa. For more examples, see the tests in the tests/ directory that have the form lab1-p3-X-in.txt for the input, and the matching lab1-p3-X-out.txt for the expected output. Note that here we are selecting a line if it is divisible by the previous line
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
