Answered step by step
Verified Expert Solution
Link Copied!

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]

image text in transcribed

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

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions