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,[email protected]
Josephine,Darakjy,[email protected]
ART,VENERE,[email protected]
...
The prospect_clean.csv file
First,Last,email
James,Butler,[email protected]
Josephine,Darakjy,[email protected]
Art,Venere,[email protected]
...
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.
#include<stdio.h>
#include<ctype.h>
int main(int argc, char **argv)
{
int
i,space_count,column_count,letter_position,line_count;
char container,pre_container;
FILE *input,*output;
pre_container = 'a';
input=fopen("prospects.csv","r");
if(input == NULL)
{
printf("\n\t Error in reading
file\n");
return 1;
}
output=fopen("prospects_clean.csv","w");
if(output == NULL)
{
printf("\n\t Error in writing
file\n");
return 1;
}
space_count=0;
column_count=1;
letter_position=0;
line_count = 0;
fscanf(input,"%c",&container);
while(container != EOF)
{
if((container=='
')||(container=='\t'))
{
space_count++;
line_count=0;
}
else if(container ==',')
{
space_count =
0;
column_count++;
letter_position
= 0;
line_count =
0;
fprintf(output,",");
}
else if(container=='\n')
{
space_count =
0;
column_count =
1;
letter_position
= 0;
line_count++;
/* As end of file
differ in each operating system. In my PC, at the end of file I get
newline character in scanning */
if((line_count
>= 3)||(pre_container == '\r'))
{
fprintf(output,"\r\n");
break;
}
else
if(line_count == 1)
fprintf(output,"\n");
else
;
}
else if((letter_position==0)
&& (column_count != 3))
{
space_count =
0;
line_count =
0;
if(islower(container))
fprintf(output,"%c",toupper(container));
else
fprintf(output,"%c",container);
letter_position
++;
}
else
{
line_count =
0;
for(i=0;i<space_count;i++)
{
fprintf(output," ");
}
space_count=0;
if(isupper(container))
fprintf(output,"%c",tolower(container));
else
fprintf(output,"%c",container);
letter_position
++;
}
pre_container = container;
fscanf(input,"%c",&container);
}
fclose(input);
fclose(output);
printf("\n\tCongratulations! Your file has been
cleaned!\n");
return 0;
}
==================================================================
==================================================================
==================================================================
prospect.csv
==================================================================
prospect_clean.csv
I can't get the program to read from prospect.csv file and produce the correct prospect_clean.csv file....
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...
In C++ please! Project 6-1: Email Creator Create a program that reads a file and creates a series of emails Console Email Creator [email protected] [email protected] Тo: From: Subject: Deals! Hi James, We've got some great deals for you. Check our website! [email protected] [email protected] To From Subject: Deals! Hi Josephine, We've got some great deals for you. Check our website! [email protected] To From [email protected] Subject: Deals! Hi Art We've got some great deals for you. Check our website! Specifications Your instructor...
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,[email protected]" "Josephine,Darakjy,[email protected]" "ART,VENERE,[email protected]" Store a template for a mass email like this: String template = "To: {email}\n" + "From: [email protected]\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...
Lab 1.4: Arrays, File I/O and Method Review (40 pts) Assume you work for a company that received a list of email addresses of potential new customers from a data broker. Your company receives a file named customers.txt with the below information: Jiming Wu [email protected] James Brown [email protected] Leanna Perez [email protected] Xing Li [email protected] Stacey Cahill [email protected] Mohammed Abbas [email protected] Kumari Chakrabarti [email protected] Shakil Smith Shakattaq2G.com Jung Ahrin [email protected] Pedro Martinez [email protected] Ally Gu [email protected] Tamara White [email protected] Alvin Ngo...
Java2 Screenshot of the output required Put some comment This is the mailing text file for the assignment ..Il AT&T令 12:28 AM Back Complete and Submit Lab 2C Detail Submission Grade Complete and Submit Lab 2C Due: Mar 1, 2019 at 11:59 PM In class you learned how to read text from a file using the Scanner class and write text to a file using the Formatter class. This lab allows you to apply the skills you learned about files...
Write a Python program named aIP.py which will read data from a file named wireShark.txt and extract all the pairs of source and destination ip addresses and output them in pairs to another file called IPAddresses.txt , one per line, listing source and destination. Example of output: Source Destination 192.168.1.180 239.255.255.250 Detailed Requirements: You will read from a file called wireShark.txt which, to avoid problems with finding paths, will be located in the same directory as your code You will...
Python Coding The script, `eparser.py`, should: 1. Open the file specified as the first argument to the script (see below) 2. Read the file one line at a time (i.e., for line in file--each line will be a separate email address) 3. Print (to the screen) a line that "interprets" the email address as described below 4. When finished, display the total number of email addresses and a count unique domain names Each email address will either be in the...
C Program In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenère cipher. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below. Command Line Parameters Your program must compile and run from the command line. The program executable must be named “vigenere” (all lower...
How do I correct this error in my code? When it got to the file type I can only go "null" from a certain point and I'm wondering how to correct this error. Also can I get a word document on this coding strategy for this problem? How much of this am I doing correctly? The original problem description: Create a program that provides a listing of all the files in a directory. The program should be a Java application...
This is subject of C++ Your program should read the file answers.dat. This file contains the name of the student who took the quiz, and his answers for each question. The answers file has the following format: The student name is always the first line. A student name may or may not have last names. For example, both Elvis Presley and Cher took this class. A quiz always has 11 questions. There is one answer per line. Each answer is...