Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA My program takes in a file that contains intervals separated by semicolons. For example: 1, 15; 16, 30 1, 10; 11, 20; 21, 30

JAVA

My program takes in a file that contains intervals separated by semicolons. For example:

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

I need to go through each line and see if an input variable is contained in that line's intervals. For example, if I am looking at the first line of the file

1, 15; 16, 30

I have two intervals, (1, 15) and (16, 30). If my input variable is 7, then it belongs to the first interval (1, 15).

My question is, what is the easiest way to go through each line and make it so that I can turn that line into actual interval variables I can compare my input variable to? And how do I do that when some lines contain more than two intervals?

Any help is extremely appreciated!

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions