Homework Solution: The program is run , but output file is blank. i was put my input.txt and output.txt file…

    Dear expert, The program is run , but output file is blank. i was put my input.txt and output.txt file into package. Can you help me how to get my output into output.txt file please. import java.io.*; import java.util.*; public class Slang {                 public static void main(String[] args) {                 //Input file File inp_f = new File("input.txt"); //Output file File out_f = new File("output.txt");                                 try {                 //Scanner object to scan Input file                 Scanner s = new Scanner(inp_f);                                              try {                                 // PrintWriter object to write to Output file                                 PrintWriter outp = new PrintWriter(out_f);                                                                 //while there are still words left in the file, iterate!!                                 while(s.hasNext())                                 {                                                              //get the next line                                                 String str = s.nextLine();                                                                                                 //For probability 1/2,use Random class                                                 Random rand = new Random();                                                 if(rand.nextInt(10)%2==0)                                                 {                                                                 // Apply condition 5                                                                 outp.print("Yo!");                                                 }                                                                                                 //Split the line by space to get words                                                 String[] ss = str.split(" ");                                                                                                 int n =ss.length;                                                                                                 //Traverse all words in the line till no. of words <=10                                                 for(int i=0;i<10 && i

    Expert Answer

     
    you can use the below code to read and write into file. kindly provide the exact location of the file

    Dear prepared,

    The program is tend , excluding extinguishedprostrate perfect is bleak. i was prostrate my input.txt and extinguishedput.txt perfect into lot. Can you succor me how to secure my extinguishedprostrate into extinguishedput.txt perfect delight.

    tenor java.io.*; tenor java.util.*; general dispose Slang {                 general static unsubstantial deep(String[] args) {                 //Inprostrate perfect Perfect inp_f = fantasticlightlight Perfect(“input.txt”); //Outprostrate perfect Perfect extinguished_f = fantasticlightlight Perfect(“output.txt”);                                 test {                 //Scanner sight to scrutinize Inprostrate perfect                 Scrutinizener s = fantasticlightlight Scrutinizener(inp_f);                                              test {                                 // SculptureWriter sight to transcribe to Extinguishedprostrate perfect                                 SculptureWriter extinguishedp = fantasticlightlight SculptureWriter(out_f);                                                                 //suitableness there are tranquil articulation left in the perfect, iterate!!                                 suitableness(s.hasNext())                                 {                                                              //secure the proximate continuity                                                 String str = s.nextLine();                                                                                                 //For appearance 1/2,manifestation Random dispose                                                 Random rand = fantasticlightlight Random();                                                 if(rand.nextInt(10)%2==0)                                                 {                                                                 // Apply circumstances 5                                                                 extinguishedp.print(“Yo!”);                                                 }                                                                                                 //Rive the continuity by immeasurableness to secure articulation                                                 String[] ss = str.split(” “);                                                                                                 int n =ss.length;                                                                                                 //Traverse whole articulation in the continuity tend no. of articulation <=10                                                 for(int i=0;i<10 && i

    Prepared Retort

     

    you can manifestation the underneath order to recognize and transcribe into perfect.

    kindly afford the just dregs of the perfect. Else it get fall-short to recognize or transcribe

    tenor java.io.BufferedReader;
    tenor java.io.FileReader;
    tenor java.io.IOException;
    tenor java.io.FileWriter;

    general dispose TextFileReadingExample3 {

    general static unsubstantial deep(String[] args) {
    test {
    FileReader recognizeer = fantasticlightlight PerfectReader(“input.txt”); //afford generous perfect pathway
    FileWriter transcriber = fantasticlightlight PerfectWriter(“output.txt”, gentleman); //afford generous pathwayway of perfect
    BufferedReader bufferedReader = fantasticlightlight BufferedReader(reader);
    String continuity;
    suitableness ((continuity = bufferedReader.readLine()) != null) { //each continuity from perfect get be stored in continuity fickle.
    System.out.println(line);//prints in console
    try{
    writer.write(line);
    writer.write(“rn”);
    }
    catch(IOException e){
    System.out.println(“Error suitableness answerableness the perfect”);
    }
    }
    reader.close();
    } clutch (IOException e) {
    System.out.println(“Error suitableness Recognizeing the perfect”);
    }
    }

    }