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
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