FIRST : Complete the Median challenge (Problem 4 on p. 568).PIC Attached ….. SECOND:
Complete the World Series Championschallenge (Problem 8) on p. 627. Use the attached text files as the source.World Series Champions In the Chap9 folder of the student sample programs, you will find the following files: •
Teams.txt
—This file contains a list of several Major League baseball teams in alphabetical order. Each team listed in the file has won the World Series at least once. •
WorldSeriesWinners.txt
—This file contains a chronological list of the World Series’ winning teams from 1903 through 2012. (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 2012. Note that the World Series was not played in 1904 or 1994.) Create an application that displays the contents of the Teams.txt file in a ListBox control. When the user selects a team in the ListBox, the application should display the number of times that team has won the World Series in the time period from 1903 through 2012. Teams.txtWorldSeriesWinners.txt
Anaheim Angels
Arizona Diamondbacks
Atlanta Braves
Baltimore Orioles
Boston Americans
Boston Braves
Boston Red Sox
Brooklyn Dodgers
Chicago Cubs
Chicago White Sox
Cincinnati Reds
Cleveland Indians
Detroit Tigers
Florida Marlins
Kansas City Royals
Los Angeles Dodgers
Milwaukee Braves
Minnesota Twins
New York Giants
New York Mets
New York Yankees
Oakland Athletics
Philadelphia Athletics
Philadelphia Phillies
Pittsburgh Pirates
San Francisco Giants
St. Louis Cardinals
Toronto Blue Jays
Washington Senators
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
New York Yankees
San Francisco Giants
St. Louis Cardinals
San Francisco Giants4. Calculate the Median
Create an application that does the following:
1. Generates an array of randomly generated integers between 1 and 100. The
length of the array should also be randomly generated as an integer between 5
and 10.
2. Sorts the array in ascending order.
3. Calculates and displays the median value, which is mathematically defined as
the midpoint value. If the array has an odd number of values such as {2, 20, 35,
106, 117), the median is the single integer in the middle (35). If the array has an
even number of values, the median is the average of the two center values. For
example, in the array {2, 20, 35, 37, 106, 117}, the median is (35 + 37)/ 2.0 =
36.0. Hint: be sure to declare the median variable as type Double. An example
is shown in Figure 8-49, in which the array contains an even number of values.
4. Let the user generate the array and calculate the median by clicking a single button.
5. Display the median in a Label control.
Figure 8-49 Calculating the Median value
Calculate the Median
X
Randomly generated integer array
35,44,58,73,85,92,96
Calculate
Median value
73.00