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

Have two methods in a class (below). All of my coding is under the process(Strin

ID: 3546078 • Letter: H

Question

Have two methods in a class (below). All of my coding is under the process(String fileName) method. I need some assistance with the process(Reader reader) method. I need to be able to take the input convert it to a string and then run the process(String fileName) method. I have having trouble building the try/catch under the process(Reader reader) method to convert the input to a string and run the code I built for a String input.


    public int process(Reader reader)

    {

     .....

    }


   public int process(String fileName)

    {

    .....

    }

Explanation / Answer

public int process(Reader reader)

{

Scanner s = new Scanner(reader).useDelimiter("\A");

String s2="";

if (s.hasNext())

{

s2=s.next();

}

// use your s2 variable in further code...

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote