Question: I need this program in java This is the txt file 1, 15; 16, 30 1, 10; 11, 20; 21, 30 1, 5; 6, 10;

I need this program in java

This is the txt file

1, 15; 16, 30

1, 10; 11, 20; 21, 30

1, 5; 6, 10; 11, 15

1, 3; 4, 6; 7, 9; 10, 12

1, 12; 13, 24

It has a method foo(n). The n value corresponds to the row in the above array. If n == 2 then the row it's refering to is 1, 10; 11, 20; 21, 30.

It has another method private int check(int val) that returns the equivalence class that val is in. The equivalence classes are seperated by semicolons. For example 1, 10; 11, 20; 21, 30 has 3 equivalence classes. So if the val == 3 and n == 2 (using the second row), then the int check(int val) should return 1 (because 3 is in the first equivalence class of 1,10).

The number val can be randomly generated. Output all the results of val into a output txt file. Make sure the outputs are seperated by commas. For example using 3 as the val the output should be 3, 1.

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!