Assignment 6

Click Here to Download this Answer Instantly

The attached file (attendance.txt) is a list of email addresses you collected for a conference your company hosted. Create a program that will parse each email address by its name and company. (Note: email parser object is attached). The company should be sorted in the first column and the person’s name associated with the company should be sorted in the second column; separated with tab character. (first sort is by company; secondary sort is by firstname.lastname). Sample output is listed below:

amzn bob.freed
amzn caitlin.thomas
amzn edward.flak
amzn jill.bennet
amzn mike.reade
fb chris.booker
fb fred.smith
fb jane.bland
fb megan.hill
goog gary.teafer
goog john.kohl
goog larry.page
goog phil.heal
goog zara.war
msft alan.gret
msft darlene.neddle
msft don.shaffer
msft ken.smith
msft sue.flemming
orcl heidi.opal
orcl john.voy
orcl larry.lee
orcl mark.lite

Create a histogram on the number of attendees per company for the conference. (can be in same program as #1)

Check if bill.gates attended the conference.Output that Bill Gates attended conference. (can be in same program as #1)

Create an output text file for the output above so that it can be imported in Excel for further analysis. One method of code to write text to an output file: (can be in same program as #1)

String text = “my text\r\n”;
BufferedWriter output = null;
try {
File file = new File(“example.txt”);
output = new BufferedWriter(new FileWriter(file));
output.write(text);
} catch ( IOException e ) {
e.printStackTrace();
} finally {
if ( output != null ) {
output.close(); // need to close file to write to a file
}
}

Assignment #4:
Write a program(main() method) that reads an arbitrary number of integers that are in the range of 0 to 50 inclusive and counts how many occurrences of each are entered. After all inputs have been processed, print only the values that have an occurrence of greater than zero. Also, print the number of occurrences next to the value. [use arrays and indexing ]

e.g.

Enter a value between 0 and 50 [ -1 to end ]: 10
Enter a value between 0 and 50 [ -1 to end ]: 2
Enter a value between 0 and 50 [ -1 to end ]: 30
Enter a value between 0 and 50 [ -1 to end ]: 10
Enter a value between 0 and 50 [ -1 to end ]: 3
Enter a value between 0 and 50 [ -1 to end ]: 10
Enter a value between 0 and 50 [ -1 to end ]: 30
Enter a value between 0 and 50 [ -1 to end ]: 2
Enter a value between 0 and 50 [ -1 to end ]: -1

Output:

The value of 2 has 2 occurrences.
The value of 3 has 1 occurrences.
The value of 10 has 3 occurrences.
The value of 30 has 2 occurrences.

Write a program (main() method) that reads, from the terminal (screen), sequence of names and postal (ZIP) codes for individuals. Store the data in an object designed to store a first name (String), last name (String), and postal code (int). Assume each line of input will contain two strings followed by an integer value, each separated by a tab character. Users will type “quit” when they have completed input entry. Print the output of the input values by the user to the screen.
[use ArrayList to store object]
[Note:
create an object that will store the first name (String), last name (String), postal code (int)
use ArrayList to store object]

C:\Enter Input {first_namelast_namezip_code}:
Bill Smith 10002
Enter Input {first_namelast_namezip_code}:
Jane Dome 11354
Enter Input {first_namelast_namezip_code}:

Revise #2 problem to read a list of inputs from a file. The input file will contain two strings followed by an integer.

Input file:
Bill Smith 10002
Jill Ryan 11120
Robert Johnson 11122
.
.