Question

I need help with this Java question. Please only answer in Java. Also, please answer it...

I need help with this Java question. Please only answer in Java.

Also, please answer it as simple as possible thanks.

Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file.

Console

File Cleaner

Source file:  prospects.csv

Cleaned file: prospects_clean.csv

Congratulations! Your file has been cleaned!

The prospect.csv file

FIRST,LAST,EMAIL

james,butler,jbutler@random.com

Josephine,Darakjy,josephine_darakjy@darakjy.org

ART,VENERE,ART@VENERE.ORG

The prospect_clean.csv file

First,Last,email

James,Butler,jbutler@random.com

Josephine,Darakjy,josephine_darakjy@darakjy.org

Art,Venere,art@venere.org

Specifications

Your instructor should provide a CSV file named prospects.csv that contains a list of prospects.

Your application should fix the formatting problems and write a file named prospects_clean.csv.

All names should use title case (an initial capital letter with the rest lowercase).

All email addresses should be lowercase.

All extra spaces at the start or end of a string should be removed.

Criteria

Fix formatting. Your application should fix the formatting problems.

Write 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 start or end of a string should be removed.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

SOURCE CODE IN JAVA:

import java.util.Scanner;

import java.io.File;

import java.io.FileWriter;

class Main

{

public static void main(String[] args)

{

try

{

Scanner in=new Scanner(new File("prospects.csv")); //to read from input file

FileWriter out=new FileWriter(new File("prospects_clean.csv")); //to write into output file

while(in.hasNextLine()) //while input file has more lines to read

{

String line[]=in.nextLine().split(","); //reading a line and spliting it into an array

line[0]=line[0].trim(); //trimming whitespaces from beginning and ending

line[0]=line[0].substring(0, 1).toUpperCase()+line[0].substring(1).toLowerCase(); //converting to title case

line[1]=line[1].trim(); //trimming whitespaces from beginning and ending

line[1]=line[1].substring(0, 1).toUpperCase()+line[1].substring(1).toLowerCase(); //converting to title case

line[2]=line[2].trim(); //trimming whitespaces from beginning and ending

line[2]=line[2].toLowerCase(); //converting to lower case

out.write(line[0]+","+line[1]+","+line[2]+"\n"); //writing to file

}

in.close(); //closing input file

out.close(); //closing output file

}

catch(Exception e) //catching Exceptions

{

System.out.println(e);

}

}

}

INPUT FILE:

OUTPUT FILE:

Add a comment
Know the answer?
Add Answer to:
I need help with this Java question. Please only answer in Java. Also, please answer it...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I can't get the program to read from prospect.csv file and produce the correct prospect_clean.csv file....

    I can't get the program to read from prospect.csv file and produce the correct prospect_clean.csv file. Can you help with explanation to the answer? Project 15-3: File Cleaner Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file. Console File Cleaner Source file:  prospects.csv Cleaned file: prospects_clean.csv Congratulations! Your file has been cleaned! The prospect.csv file FIRST,LAST,EMAIL james,butler,jbutler@gail.com Josephine,Darakjy,josephine_darakjy@darakjy.org ART,VENERE,ART@VENERE.ORG ... The prospect_clean.csv file First,Last,email James,Butler,jbutler@gail.com Josephine,Darakjy,josephine_darakjy@darakjy.org Art,Venere,art@venere.org...

  • Hello can somebody please help me with Project 15-3 File Cleaner assignment? This project is to...

    Hello can somebody please help me with Project 15-3 File Cleaner assignment? This project is to be done while using Java programming. Here are what the assignment says… 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...

  • Java Email Template Application: Create an application that creates a series of emails as outlined below....

    Java Email Template Application: Create an application that creates a series of emails as outlined below. Create an array of email addresses that include the following data: "   james   ,butler,jbutler@hotmail.com" "Josephine,Darakjy,Josephine_Darakjy@darakjy.org" "ART,VENERE,ART@VENERE.ORG" Store a template for a mass email like this: String template =     "To:      {email}\n" +     "From:    noreply@deals.com\n" +     "Subject: Deals!\n\n" +     "Hi {first_name},\n\n" +     "We've got some great deals for you. Check our website!"; When the application starts, it should read the email...

  • In C++ please! Project 6-1: Email Creator Create a program that reads a file and creates...

    In C++ please! Project 6-1: Email Creator Create a program that reads a file and creates a series of emails Console Email Creator jbutler@gmail.com noreply@deals.com Тo: From: Subject: Deals! Hi James, We've got some great deals for you. Check our website! josephine_darakjy@darakjy.org noreply@deals.com To From Subject: Deals! Hi Josephine, We've got some great deals for you. Check our website! art@venere.org To From noreply@deals.com Subject: Deals! Hi Art We've got some great deals for you. Check our website! Specifications Your instructor...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • Please i need help with with this php files, the css does not have to look...

    Please i need help with with this php files, the css does not have to look like in the screen shot in the button. Create a file named paint.class.php and within it define a class named Paint, which has the following private properties: imgName title artist year gender paintID Define a static member variable named id, which will be used to set each instance’s paintID value and then be incremented, all inside the class constructor. Create a constructor that takes...

  • 6-1 Test and debug the Invoice Application i need help with this please.. all help is...

    6-1 Test and debug the Invoice Application i need help with this please.. all help is appreciated Source code Java: import java.util.Scanner; import java.text.NumberFormat; public class InvoiceApp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String choice = "y"; while (!choice.equalsIgnoreCase("n")) { // get the input from the user System.out.print("Enter customer type (r/c): "); String customerType = sc.next(); System.out.print("Enter subtotal: "); double subtotal = sc.nextDouble(); // get the discount percent double discountPercent = 0.0; switch(customerType) {...

  • Really need help with this. This is for my Advanced Java Programming Class. If anyone is...

    Really need help with this. This is for my Advanced Java Programming Class. If anyone is an expert in Java I would very much appreciate the help. I will provide the code I was told to open. Exercise 13-3   Use JPA to work with the library checkout system In this exercise, you'll convert the application from the previous exercise to use JPA instead of JDBC to access the database. Review the project Start NetBeans and open the project named ch13_ex3_library that's...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

  • Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by...

    Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by implementing Person and Student classes. Once you are sure you can serialize and deserialize and ArrayList of Students to and from a file, move on to building the GUI application. Person: The Person class should implement serializable interface. It contains the following: Person's first name (String) Person's last name (String) Person's id number Person's date of birth (Date) public String toString(): This method method...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT