import java.util.*; import java.io.*; public class Names{ public static void main(String[] args) throws FileNotFoundException{ Scanner console = new Scanner(System.in); printIntro(); String data = (searchName(console)); } public static void printIntro(){ System.out.println("This program searches for a name contained in the Social Security Administration"); System.out.println("and displays a graph that contains the rank of name (1-1000) of that name in each decade from 1900-2000"); System.out.println("or 1920-2000. 0 means that the name was not in the top 1000 for that year."); } public static String searchName(Scanner console) throws FileNotFoundException{ System.out.print("What name would you like to search for? "); String phrase = console.nextLine().toLowerCase(); Scanner names = new Scanner(new File("names.txt")); //search for name while (names.hasNextLine()){ String line = names.nextLine(); if (line.toLowerCase().contains(phrase)){ return line; } //if found: construct drawing panel and show graph //else: print name not found } return ""; } public static void drawData(){ if (String data != ""){ } else { System.out.println("name not found") } } }