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

Write a perl program that corrects the broken delimiting in cs371598roster.raw.

ID: 3845419 • Letter: W

Question

Write a perl program that corrects the broken delimiting in cs371598roster.raw. Your program must print the roster with corrected delimiting--comma followed by exactly 1 space, no space before commas. You will get 2 points extra credit if you use regular expression search and replace to correct the delimiting. Include the source code of your program in perl_assignment.txt. cs371598roster.raw: Drew,Matthew J. , s1058828 Howerth, Chloe E., s1002240 Karolewicz, Michael J., s0995867 Perzely, Connor J.,s0958005 Tanenbaum, Roberto,s1124377 Williams, Gregory M., s1186794 Guan,Tiffany , s1103462 Jaligama,Vishnu Praneeth, s1143667 Jin, Ailan , s1152308 Miceli, Paul V. , s0937120 Shukla, Prerana, s1113985 Torrenegra , Harry E., s0894879 Mathighatta Shivakumar, Meghana, s1175925 Tangirala, Venkata Naga Sai Meghana, s1087887

Explanation / Answer

Rostersisplay.java

package venkanna;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Rosterdisplay
{
   public static void main(String[] args) throws IOException {
   String line = null;
   String[] arr2 = new String[7];
   int count = 0, i = 0;
   File file = new File("D:\New folder\cs371598roster.raw");
   FileWriter fw = null;
   try
   {
       Scanner sc = new Scanner(file);
       BufferedReader br = new BufferedReader(new FileReader(file));
       while (sc.hasNextLine())
       {
           line = sc.nextLine();
           String arr[] = line.split("[,]");
           for (String word : arr)
           {
               System.out.println(word);
           File file1 = new File("D:\New folder\perlAssignment.txt");
           if (!file1.exists())
           {
               file1.createNewFile();
           }
           fw = new FileWriter(file1);
           fw.write(word);
           }
  
       }
   }
   catch (FileNotFoundException e) {
       e.printStackTrace();
   }
   }

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