((Java)) Ask the user for some letters. Display, in alphabetical order, a list of email address domains from users that have a first name that begins with the inputted letters.
A domain is the characters after the @ symbol.
test@domain.com
| Standard Input | Files in the same directory |
|---|---|
Hea |
|
Output == Domain Lookup ==\n Enter some letters\n Here are the domains of the users that begin with Hea\n free.fr\n Found 1 domain(s)\n
| Standard Input | Files in the same directory |
|---|---|
He |
|
Output == Domain Lookup ==\n Enter some letters\n Here are the domains of the users that begin with He\n apple.com\n artisteer.com\n cnbc.com\n free.fr\n google.it\n ihg.com\n indiatimes.com\n mtv.com\n myspace.com\n pbs.org\n printfriendly.com\n spiegel.de\n surveymonkey.com\n wufoo.com\n Found 14 domain(s)\n
| Standard Input | Files in the same directory |
|---|---|
X |
|
Output == Domain Lookup ==\n Enter some letters\n Here are the domains of the users that begin with X\n tumblr.com\n Found 1 domain(s)\n
| Standard Input | Files in the same directory |
|---|---|
Fer |
|
Output == Domain Lookup ==\n Enter some letters\n Here are the domains of the users that begin with Fer\n dailymail.co.uk\n ebay.co.uk\n indiegogo.com\n rediff.com\n unblog.fr\n Found 5 domain(s)\n
mock-data.csv
Sheilds,Nisse,nsheildsqp@squarespace.com,New York Lamblin,Codie,clamblinqq@amazon.de,New Jersey Bagenal,Emlynne,ebagenalqr@wikispaces.com,Texas Krier,Sacha,skrierqs@youtube.com,South Carolina Sammonds,Diana,dsammondsqt@smugmug.com,Virginia Franceschielli,Amara,afranceschielliqu@diigo.com,Texas Coulston,Nicholas,ncoulstonqv@list-manage.com,Texas Cadigan,Sampson,scadiganqw@stanford.edu,Georgia Simanenko,Eleanore,esimanenkoqx@craigslist.org,North Carolina Jayes,Brooke,bjayesqy@google.com.au,California Beardsdale,Ferdinanda,fbeardsdaleqz@ebay.co.uk,California Pandie,Melamie,mpandier0@bravesites.com,Maryland Dandie,Clement,cdandier1@cloudflare.com,South Carolina Keenor,Mitchael,mkeenorr2@google.pl,Oklahoma Joinsey,Cole,cjoinseyr3@360.cn,Texas Hanington,Warren,whaningtonr4@dmoz.org,Ohio Bunny,Mose,mbunnyr5@wikimedia.org,Georgia Streader,Trumann,tstreaderr6@mail.ru,California Stenning,Hailee,hstenningr7@foxnews.com,Louisiana Lillywhite,Case,clillywhiter8@mysql.com,California Derisley,Ethelind,ederisleyr9@nifty.com,Colorado Carmichael,Raphaela,rcarmichaelra@mayoclinic.com,Kansas Shurey,Georgie,gshureyrb@mozilla.com,North Carolina Turpin,Laraine,lturpinrc@accuweather.com,Michigan Paulus,Tressa,tpaulusrd@jimdo.com,New York Gon,Heidi,hgonre@mtv.com,Connecticut Lindroos,Melisse,mlindroosrf@bbc.co.uk,Louisiana Mathy,Glennis,gmathyrg@answers.com,Ohio Doul,Joellyn,jdoulrh@fotki.com,Texas Skellern,Hersch,hskellernri@artisteer.com,New York Brindley,Griz,gbrindleyrj@census.gov,Virginia Ghidoli,Georgena,gghidolirk@ted.com,North Dakota Lyddy,Knox,klyddyrl@blog.com,New Jersey Osborne,Fidole,fosbornerm@bluehost.com,Minnesota Chapelhow,Mick,mchapelhowrn@theglobeandmail.com,District of Columbia Pennini,Filip,fpenniniro@tamu.edu,Texas Lindsey,Abagael,alindseyrp@zimbio.com,Florida Birrane,Kaye,kbirranerq@technorati.com,California Simmens,Anthia,asimmensrr@youtube.com,Delaware
Please let me know if you have any doubts or you want me to modify
the answer. And if you find this answer useful then don't forget to
rate my answer as thumps up. Thank you! :)
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class Driver implements Comparable<PeopleData>
{
private static String first;
private static String last;
private static String email;
private static String state;
public static ArrayList<String>
loadDatabase() {
File f = new
File("/Users/swapnil/IdeaProjects/DisplayNAme/src/mockdata.txt");
ArrayList<String>
result = new ArrayList<>();
try {
Scanner inputFile = new Scanner(f);
while (inputFile.hasNextLine()) {
String[] temp = inputFile.nextLine().split(",");
first = temp[0];
last = temp[1];
email = temp[2];
state = temp[3];
result.add(String.valueOf(new PeopleData(first, last, email, state)));
}
} catch
(FileNotFoundException e) {
System.out.println("File is not found!");
}
return result;
}
public static String searchLetter(String
search){
if
(getFirst().contains(search)){
}
return email;
}
public static String getFirst(){
return first;
}
public static void main(String[] args){
ArrayList<String>
data = new ArrayList<>();
loadDatabase();
Scanner keyboard = new
Scanner(System.in);
System.out.println("== Domain Lookup ==");
System.out.println("Enter some letters");
System.out.println(data.size());
System.out.println(data);
String search =
keyboard.nextLine();
System.out.println(searchLetter(search));
}
@Override
public int compareTo(PeopleData o) {
return 0;
}
}
----------------------------------------------------------------------------------------------------------------------------------
public class PeopleData {
private String first;
private String last;
private String email;
private String state;
public PeopleData(String first, String last,
String email, String state) {
this.first =
first;
this.last = last;
this.email =
email;
this.state =
state;
}
}
![DisplayNAme /ldeaProjects/DisplayNAme] - .../src/Driver.java [DisplayNAme] ,DisplayNAme-src ƠDriver G Driverjava 렙 mockdata.t](http://img.homeworklib.com/images/5056e72d-962d-4e28-b581-94a584d7f632.png?x-oss-process=image/resize,w_560)
((Java)) Ask the user for some letters. Display, in alphabetical order, a list of email address d...
Form Processing HTML
One of the most ubiquitous uses of JavaScript is validating form
data on the client side before it is submitted to the server. It is
done everywhere because it is fast and it gives you a great deal of
flexibility in how you handle errors insofar as the GUI is
concerned.
Attached is an image of some code I wrote (so Blackboard can't
mess it up). Some things to notice that will help you with the
lab....