Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package worldseries;
- import java.util.*;
- import java.io.*;
- /**
- *
- * @author keyof
- */
- public class WorldSeries {
- public static void main(String[] args) throws IOException
- {
- firstPart();
- System.out.println("###################");
- secondPart();
- }
- static void firstPart()throws IOException{
- String line;
- File file = new File("Teams.txt");
- Scanner in = new Scanner(file);
- while (in.hasNext())
- {
- line= in.nextLine();
- System.out.println(line);
- }
- in.close();
- }
- static void secondPart() throws IOException {
- File file = new File("WorldSeriesWinners.txt");
- Scanner in = new Scanner(file);
- Scanner userIn = new Scanner(System.in);
- String line;
- int output = 0;
- String input;
- System.out.println( "Enter a team's name");
- input = userIn.nextLine();
- System.out.println("Finding World Series Championship Count For: " +input);
- while (in.hasNext())
- {
- line = in.nextLine();
- if (line.equals(input)) {
- output++;
- }
- }
- in.close();
- System.out.println("Win Count For " + input + "Win Count For " + input + " : " + output );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement