Question: JAVA PROGRAM: In JAVA write a program where there is a circular bus course with multiple stations, and there are multiple bus lines. Each line
JAVA PROGRAM:
In JAVA write a program where there is a circular bus course with multiple stations, and there are multiple bus lines. Each line covers a part of the circular course. For example, there are N=10 stations and 5 lines, [0,4], [2,6], [5,0], [7,9] and [9,4] like below.

Because of the short budget, now we want to cancel the lines that can be covered by other lines. For example, the line #1 can be covered by line #5. Also, the line #3 can cover the line #4. So, we can cancel the bus line #1 and 4. Please make a program in JAVA that displays the bus lines that do not need to be canceled given a number of bus stations and multiple bus lines as a text file (see the example below). The number of bus stations is on the first line; the number of bus lines is on the second line, and then the range of stations each bus line covers are following sequentially.
Please use basic input/output file operations:(import java.util.*;, import java.io.*;, PrintWriter,throws IOExecption,FileWriter, Reading Data From a File using File f1= new File("input.txt"); Scanner s1 = new Scanner(f1);
Example of input file (input.txt)
10
5
0 4
2 6
5 0
7 9
9 4
Example of output
2 3 5
2 87 2 87
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
