Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Prompt You must first read in a filepath from the command line (System.in) followed by a criteria to be tested, either within or overlap. Within
Prompt You must first read in a filepath from the command line (System.in) followed by a criteria to be tested, either "within" or "overlap". Within the file you must read in ranges in the following format: lower1-upper1,lower2-upper2 Each line of the file will contain 1 pair of ranges. You must then determine how many pairs within the file pass the criteria. Namely, if the criteria is "within" then you would count how many lines have ranges where one range is contained within the other range. Or if the criteria is "overlap" then you would count how many lines have ranges where one range overlaps with the other range. You must then print this count followed by a newline without any other text. Then you must read in another filepath and criteria. You must repeat this process until the filepath is "DONE", then your program should exit gracefully. For example if a file contains the following ranges: 24,68 23,45 57,79 28,37 66,46 26,48 And the criteria is "within" then you would print " 2 " because the range 37 is fully within the range 28 and the range 66 is fully within the range 4-6. Whereas if the criteria was "overlap" then you would print " 4 " because the range 57 overlaps with the range 7-9, the range 2-8 overlaps with the range 37, the range 6-6 overlaps with the range 4-6, and the range 2-6 overlaps with the range 4-8. Here is a transcript of my program running: docs/lab1/test_case1.txt within wi docs/lab1/test_case1.txt overlap 4 DONE This assumes you have a docs folder in the root of your project with a lab1 folder within it and a test_case1.txt file within that folder. test_case1.txt looks like this: 1 24,68 23,45 57,79 28,37 66,46 26,48 I have also included this file in the lab1 link on canvas. We will be running your code on much longer test cases then the file given so make sure to thoroughly test your code! Submission Submit a zip of only your java source files onto canvas. No other files or folders should be within the zip file ONLY your java source files
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