Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hey, i need help in doing the following using recursion for javacode so here is

ID: 3618446 • Letter: H

Question

Hey, i need help in doing the following using recursion for javacode so here is what i want i want to read a file that contains a code like this onebelow if(A&&B) {    if(C){     print(something)          } } else {     while(D || E){          print(anything)         } } So, what i need is to read the file line by line and storeeach line in arraylist after that I want to read the stored arraylist and checkfor what ever comes after if, else, while, for, do while like(A&&B) then check for "{" and "}" signs to know wheredoes each method stops using a recursive method

the reason why i want this is to build a graph after reading thewhole code that shows all the possible paths


thanks and please help Hey, i need help in doing the following using recursion for javacode so here is what i want i want to read a file that contains a code like this onebelow if(A&&B) {    if(C){     print(something)          } } else {     while(D || E){          print(anything)         } } So, what i need is to read the file line by line and storeeach line in arraylist after that I want to read the stored arraylist and checkfor what ever comes after if, else, while, for, do while like(A&&B) then check for "{" and "}" signs to know wheredoes each method stops using a recursive method

the reason why i want this is to build a graph after reading thewhole code that shows all the possible paths


thanks and please help

Explanation / Answer

08.{ 09.    public staticvoid main(String[]args) 10.    { 11.        File file = new File("test.txt"); 12.        StringBuffer contents = newStringBuffer(); 13.        BufferedReader reader = null; 14. 15.        try 16.        { 17.            reader = new BufferedReader(new FileReader(file)); 18.            String text =null; 19. 20.            // repeatuntil all lines is read 21.            while ((text =reader.readLine()) != null) 22.            { 23.                contents.append(text) 24.                    .append(System.getProperty( 25.                        "line.separator")); 26.            } 27.        } catch (FileNotFoundException e) 28.        { 29.            e.printStackTrace(); 30.        } catch(IOException e) 31.        { 32.            e.printStackTrace(); 33.        } finally 34.        { 35.            try 36.            { 37.                if (reader != null) 38.                { 15.        try 16.        { 17.            reader = new BufferedReader(new FileReader(file)); 18.            String text =null; 19. 20.            // repeatuntil all lines is read 21.            while ((text =reader.readLine()) != null) 22.            { 23.                contents.append(text) 24.                    .append(System.getProperty( 25.                        "line.separator")); 26.            } 27.        } catch (FileNotFoundException e) 28.        { 29.            e.printStackTrace(); 30.        } catch(IOException e) 31.        { 32.            e.printStackTrace(); 33.        } finally 34.        { 35.            try 36.            { 37.                if (reader != null) 38.                { 20.            // repeatuntil all lines is read 21.            while ((text =reader.readLine()) != null) 22.            { 23.                contents.append(text) 24.                    .append(System.getProperty( 25.                        "line.separator")); 26.            } 27.        } catch (FileNotFoundException e) 28.        { 29.            e.printStackTrace(); 30.        } catch(IOException e) 31.        { 32.            e.printStackTrace(); 33.        } finally 34.        { 35.            try 36.            { 37.                if (reader != null) 38.                {