Question: Write an application called BabyNames1900sAnd2000s to print two columns in alphabetical order. The first column will contain all the boys names for 1900s that were
Write an application called BabyNames1900sAnd2000s to print two columns in alphabetical order. The first column will contain all the boys names for 1900s that were still popular in 2000s. The second column will contain all the girls names for 1900s that were still popular in 2000s. Make the columns 30 characters wide and left justified.
There are two files:
http://www.laughton.com/obrien/sjsu/cs49j/files/babynames1900s.txt
http://www.laughton.com/obrien/sjsu/cs49j/files/babynames2000s.txt
This is my code:
And, my result has some problem, I can't find out.
You can change my code, but I hope don't change my idea.
//**************************************************
import java.io.File; import java.io.FileNotFoundException; import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner;
public class BabyNames1900sAnd2000s { public static void main(String[] args) throws FileNotFoundException{ URL pageLocation1 = new URL("http://www.laughton.com/obrien/sjsu/cs49j/files/babynames1900s.txt"); URL pageLocation2 = new URL("http://www.laughton.com/obrien/sjsu/cs49j/files/babynames2000s.txt"); Scanner scan1 = new Scanner(pageLocation1.openStream()); Scanner scan2 = new Scanner(pageLocation2.openStream()); /*if (args.length
ArrayList
ArrayList
ArrayList
while(scan1.hasNextLine() && scan2.hasNextLine()) { String line1 = scan1.nextLine(); String line2 = scan2.nextLine(); String [] description1 = line1.split("\\s+"); String [] description2 = line1.split("\\s+");
boys1900.add(description1[1]); boys2000.add(description2[1]);
girls1900.add(description1[3]); girls2000.add(description2[3]); }
scan1.close(); scan2.close();
for(int i=0; i for(int i=0; i printPopularNames(boysPopular, girlsPopular); } private static void printPopularNames(ArrayList if(i //My code has some issues. The desired result is like this: 
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
