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

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

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

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

}

in java please!!!

Part 5. [10 marks] Given a file where each line is a single (32-bit) integer, read in the lines of the file one at a time; output the sum modulo 240223 of every vth line starting from the Oth, in the modified list made from the file where value i is inserted after line iv for each i=1,2,, floor (n/v), until you've summed n values, where n is the number of lines in the file, and v>0 is the value of the last line. If the file is empty, output 0 . For example, if the input is then the modified list is 10 20 1 i=1 inserted after iv =2 lines of original list 30 40 2 i=2 inserted after iv=4 lines of original list 50 2 3i=3 inserted after iv =6 lines of original list And the final sum is (10+1+40+50+3+20)%240223=124. For more examples, see the tests in the tests/ directory that have the form lab1-p5-X-in.txt for the input, and the matching lab1-p5-X-out.txt for the expected output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!