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!!! 0 ) integer, read

image text in transcribed

public static void execute(BufferedReader r, PrintWriter w) throws IOException, NumberFormatException {

// TODO(student): Your code goes here.

}

in java please!!!

0 ) integer, read in the lines of the file one at a time; print out the first Y lines that are multiples of x, where x>0 is a parameter to the execute method, and Y is the number of lines that are multiples of x2. For example, if x=2 and the input is 4659308multipleofxandx2multipleofxbutnotx2neithermultipleofxnorx2neithermultipleofxnorx2multipleofxbutnotx2multipleofxandx2 Then the output is 46 because Y=2 (there are 2 lines that are multiples of x2=4 ) and 4,6 are the first Y lines that are divisible by x=2. If x=3 with this same example, we would just output 6 as there is only one multiple of 32. If x=5 we would output nothing since there are no multiples of x2=25. For more examples, see the tests in the tests/ directory that have the form lab1-p4-X-in.txt for the input, and the matching lab1-p4-X-out.txt for the expected output. You can see which parameters are used in the local json file, student_config_lab1p4.json, which says that the parameter is 4 for all of these local tests. Tip: Can you define what lines are "selected" here? Being able to express the concept in a clear, unambiguous way is a great first step to understanding the

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_2

Step: 3

blur-text-image_3

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

Students explore these related Databases questions