Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago