Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 lineStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started