Lab2C.java
/** * Name: * Course number: * Section: * This program reads a mailing list text file from disk and tells whether * the email addresses are invalid. If the email address is valid, then * it gives statistics about address and does some string manipulations * and writes to another text file. */ package abc1; import java.io.*; public class Lab2C { public static void main(String[] args) { try { File myfile = new File("src/abc1/Lab2A.txt"); //Creating file object representing text file FileReader filereader = new FileReader(myfile); //creating a connection stream for chars that connects to text file BufferedReader reader = new BufferedReader(filereader); //chain the FileReader to BufferedReader for efficiency //For output file File mynewfile = new File("src/abc1/howardBeeMailing.txt"); //creating new file FileWriter filewriter = new FileWriter(mynewfile); BufferedWriter writer = new BufferedWriter(filewriter); String line = null; while((line=reader.readLine())!=null) { //reading each line till end of file is found boolean valid = false; //initializing validity of each line as false, then we will check if(line.contains("@")) { //if email address contains @ valid = true; System.out.println(line.trim().toLowerCase()); //remove space, print in lowercase System.out.println("Length: " + line.length()); System.out.println("Characters before @: " + (line.indexOf('@'))); //calculating chars before @ System.out.println("Characters after @: " + (line.length()-line.indexOf('@')-1)); //calculating chars after @ //writing valid email addresses with @howardcc.edu to another fle if(line.contains("[email protected]")) { String str = line.trim().toUpperCase(); writer.write(str); writer.write('\n'); } else if(line.contains("howardcc.edu")) { writer.write(line.trim()); writer.write('\n'); } } else { //if email address doesn't contain @ System.out.println(line + " - " + "Email address unreadable"); } } reader.close(); writer.close(); } catch(Exception e){ e.printStackTrace(); } } }
Time taken to complete: 55 Mins
Most difficult part: Creating and accessing files.
Java2 Screenshot of the output required Put some comment This is the mailing text file for...
T-Mobile LTE 8:12 AM Back Assignment 14: Professional St.... Detail Submission Grade Assignment 14: Professional Status Due: Jul 30, 2018 at 11:59 PM Complete an essay about the current role, working environment, and people involved in your selected profession. Consider what your profession does, what the current status is (pay, demand, etc), where the profession functions (i.e., hospitals, clinics, offices, laboratories, etc.), and what the personality and demographic of the profession is (who works in that role) - This is...
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...
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...
Does any one can show me the code in C++ ll cricket LTE 80% 16:58 Back P2.B MYString v1 Detail Submission Grade For this program, your MYString variables will never need to grow beyond length 20, in program 3 you will need to be allow your string that is held in the class to be able to be larger than 20 chars. So you may want to start allowing your strings to be able to grow....if you have extra time....
C++ Lab 1. Read in the contents of a text file up to a maximum of 1024 words – you create your own input. When reading the file contents, you can discard words that are single characters to avoid symbols, special characters, etc. 2. Sort the words read in ascending order in an array (you are not allowed to use Vectors) using the Selection Sort algorithm implemented in its own function. 3. Search any item input by user in your...
10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let's call them string1, string2, and string3. It should search string for all occurrences of string2. When it finds an occurrence of Programming Challenges string2, it should replace it with string. For example, suppose the three arguments have the following values: stringt: "the dog jumped over the fence" string 2 "the" string3: "that" With these three arguments, the function would return a...
Need help!! Java Eclipse Please provide the screenshot of output of code as well. thank you... PROGRAM 1 –Linear Data Structure Implementation (Due date: March 5th, 2019, 5% Grade Points) Given the starting point in a maze, you are to find and mark a path out of the maze which is represented by a 30x30 array of 1s (representing hedges) and 0s (representing the foot-paths). There is only one exit from the maze (represented by E). You may move vertically...
Overview: file you have to complete is WordTree.h, WordTree.cpp, main.cpp Write a program in C++ that reads an input text file and counts the occurrence of individual words in the file. You will see a binary tree to keep track of words and their counts. Project description: The program should open and read an input file (named input.txt) in turn, and build a binary search tree of the words and their counts. The words will be stored in alphabetical order...
i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...