Boston Americans New York Giants Chicago White Sox Chicago C
Boston Americans
 New York Giants
 Chicago White Sox
 Chicago Cubs
 Chicago Cubs
 Pittsburgh Pirates
 Philadelphia Athletics
 Philadelphia Athletics
 Boston Red Sox
 Philadelphia Athletics
 Boston Braves
 Boston Red Sox
 Boston Red Sox
 Chicago White Sox
 Boston Red Sox
 Cincinnati Reds
 Cleveland Indians
 New York Giants
 New York Giants
 New York Yankees
 Washington Senators
 Pittsburgh Pirates
 St. Louis Cardinals
 New York Yankees
 New York Yankees
 Philadelphia Athletics
 Philadelphia Athletics
 St. Louis Cardinals
 New York Yankees
 New York Giants
 St. Louis Cardinals
 Detroit Tigers
 New York Yankees
 New York Yankees
 New York Yankees
 New York Yankees
 Cincinnati Reds
 New York Yankees
 St. Louis Cardinals
 New York Yankees
 St. Louis Cardinals
 Detroit Tigers
 St. Louis Cardinals
 New York Yankees
 Cleveland Indians
 New York Yankees
 New York Yankees
 New York Yankees
 New York Yankees
 New York Yankees
 New York Giants
 Brooklyn Dodgers
 New York Yankees
 Milwaukee Braves
 New York Yankees
 Los Angeles Dodgers
 Pittsburgh Pirates
 New York Yankees
 New York Yankees
 Los Angeles Dodgers
 St. Louis Cardinals
 Los Angeles Dodgers
 Baltimore Orioles
 St. Louis Cardinals
 Detroit Tigers
 New York Mets
 Baltimore Orioles
 Pittsburgh Pirates
 Oakland Athletics
 Oakland Athletics
 Oakland Athletics
 Cincinnati Reds
 Cincinnati Reds
 New York Yankees
 New York Yankees
 Pittsburgh Pirates
 Philadelphia Phillies
 Los Angeles Dodgers
 St. Louis Cardinals
 Baltimore Orioles
 Detroit Tigers
 Kansas City Royals
 New York Mets
 Minnesota Twins
 Los Angeles Dodgers
 Oakland Athletics
 Cincinnati Reds
 Minnesota Twins
 Toronto Blue Jays
 Toronto Blue Jays
 Atlanta Braves
 New York Yankees
 Florida Marlins
 New York Yankees
 New York Yankees
 New York Yankees
 Arizona Diamondbacks
 Anaheim Angels
 Florida Marlins
 Boston Red Sox
 Chicago White Sox
 St. Louis Cardinals
 Boston Red Sox
 Philadelphia Phillies
Use the attached WorldSeries.data file which contains the chronological list of world series winners from 1903 to 2009.
Read the data from the file into an array. When the user enters the name of the team, the program should step through the array counting the number of times the selected team appears.
The first line in the file is the name of the team that won in 1903, and the last line is the name of the team that won in 2009.
Note that the world series was not played in 1904 or 1994, so the file contains no entires for those years.
Write a program that lets the user enter the name of a team, and then displays the number of times that team has won the world series in the time period from 1903 to 2009. Please write code written in java format and not C++
Solution
import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
public class Count{
 public static void main(String[] args) throws Exception {
 BufferedReader br = new BufferedReader(new FileReader(\"C:\\Users\ itesh\\Desktop\\sample.txt\"));
 BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
 String line = null;
 String str1 = null;
 int count = 0;
System.out.println(\"Enter The team name\");
 str1=br1.readLine();
while ((line = br.readLine()) != null) {
 String[] values = line.split(\"\ \");
 for (String str : values) {
 if(str == str1)
 count = count + 1;
 }
        }
 br.close();
 br1.close();
 System.out.println(\"Number of time the team win\" + count);
}
 }



