subject

Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file. Below are the grading criteria…
Fix formatting. The application should fix the formatting problems.
Write the File. Your application should write a file named prospects_clean. csv.
Use title case. All names should use title case (an initial capital letter with the rest lowercase).
Fix email addresses. All email addresses should be lowercase.
Trim spaces. All extra spaces at the start or end of a string should be removed.
Here is the code work I was working on. It seems that there are errors happening and I get message that file is not found when using this code…
import java. io. IOException;
import java. io. BufferedReader;
import java. io. FileReader;
import java. util. ArrayList;
public class CSVReader {
// Used to read CSV file
public static ArrayList readCSV(String fileName) throws IOException {
String line = " ";
BufferedReader br = null;
ArrayList ar = new ArrayList();
br = new BufferedReader(new FileReader(fileName));
// Reading content from CSV file
while ((line = br. readLine()) != null) {
ar. add(line);
}
// Closing Buffered Reader
br. close();
return ar;
}
}
import java. util. ArrayList;
public class Cleaner {
// Convert to title case
static String convert(String str) {
str = str. toLowerCase();
char[] array = str. toCharArray();
// Modify first element in array.
array[0] = Character. toUpperCase(array[0]);
// Return string.
return new String(array);
}
// CSV cleaner
public ArrayList CSVCleaner(ArrayList fileContent) {
ArrayList cleanerCon = new ArrayList();
String delimiter = ",";
StringBuilder newLine = null;
for (String str : fileContent) {
String[] fullLine = str. split(delimiter);
newLine = new StringBuilder();
for (int i = 0; i < fullLine. length - 1; i++) {
newLine. append(convert(fullLine[i]) + ",");
}
if (EmailValidator. isValidEmail(fullLine[fullLine. length - 1].toLowerCase())) {
newLine. append(fullLine[fullLine. length-1].toLowerCase());
} else {
newLine. append(convert(fullLine[fullLine. length - 1]));
}
cleanerCon. add(newLine. toString());
}
return cleanerCon;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
These tools give presenters more freedom to move about the room and interact with their audience. laptop computer laser pointer lcd projector remote control
Answers: 2
question
Computers and Technology, 22.06.2019 04:30
Kyle, a receptionist for a building supply company, recently won an award for saving his company money on their phone system. after being presented with kyle's research, the company changed the way in which it made long-distance phone calls and cut their expenses in this area by 75 percent. the new system the kyle's company most likely adopted was wired communications switching stations voip hdtv
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Name the range function that would generate the following list of integers values: 0,1,2,3,4,5.
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
You know the right answer?
Create an application that reads a file that contains an email list, reformats the data, and writes...
Questions
question
Mathematics, 19.01.2021 08:10
question
Mathematics, 19.01.2021 08:10
question
Mathematics, 19.01.2021 08:10
question
Mathematics, 19.01.2021 08:10
question
Mathematics, 19.01.2021 08:10
question
Business, 19.01.2021 08:10
question
Social Studies, 19.01.2021 08:10
Questions on the website: 13722360