Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The array class must contain complete Javadoc documentation comments for all public members. Develop a class named WorldSeries that stores World Series winners in an

The array class must contain complete Javadoc documentation comments for all public members.

Develop a class named WorldSeries that stores World Series winners in an array of Strings. The first World Series was played in 1903 and the latest in 2016. Hence, the array must accommodate 114 elements. The class constructor should read the WorldSeriesWinners.txt file, storing each record read into an element of the array. The file provided contains each winner on a separate line, starting with the winner from 2016 and ending with the winner from 1903. For the two years when the series was not played, NO GAME PLAYED is listed.

The WorldSeries class defines methods to support queries of the array. The following methods should be defined:

displayWinners(): Displays all World Series Winners from 2016 to 1903. The year and winner should be displayed for all data items.

displayWinnersByYear(): Displays all World Series Winners from 1903 to 2016. The year and winner should be displayed for all data items.

findWinner(): Searches the array for all occurrences of the ball club name given as a parameter. The method displays the total number of times the club has won the World Series or an appropriate message when not found.

findYears(): Searches the array for all occurrences of the ball club name given as a parameter. The method displays the years that the club has won the World Series or an appropriate message when not found.

winner(): Given a year as a parameter, displays the winner for that year. An appropriate message is displayed for invalid years or years when the series was not played.

The class should use constants such that the class is easily updated in upcoming years.

Develop a client to test the WorldSeries class. The client should be menu driven, presenting a list of options to the end user, retrieving the users request, and processing that request. The menu should be displayed after each query. The program should continue until the end user indicates to terminate.

In the WorldSeries class, include an array of fun facts and a method named getFunFact()to retrieve a fun fact. When the getFunFact() method is called, the method randomly selects a fun fact from the array and returns it to the caller. The client should display the randomly selected fun fact each time the menu is displayed.

Main Menu 1 - Show all winners - descending years 2 - Show all winners - ascending years 3 - Show how many times a particular team has won 4 - Show the years that a particular team has won 5 - Show the winner for a particular year 6 - Exit Enter choice: 3 Enter a team name: Baltimore Orioles Baltimore Orioles have won the series 3 times Main Menu 1 - Show all winners - descending years 2 - Show all winners - ascending years 3 - Show how many times a particular team has won 4 - Show the years that a particular team has won 5 - Show the winner for a particular year 6 - Exit Enter choice: 4 Enter a team name: Baltimore Orioles 1983 1970 1966 Main Menu 1 - Show all winners - descending years 2 - Show all winners - ascending years 3 - Show how many times a particular team has won 4 - Show the years that a particular team has won 5 - Show the winner for a particular year 6 - Exit Enter choice: 5 Enter a year: 1997 The winner of the World Series in year 1997 was the Florida Marlins Main Menu 1 - Show all winners - descending years 2 - Show all winners - ascending years 3 - Show how many times a particular team has won 4 - Show the years that a particular team has won 5 - Show the winner for a particular year 6 - Exit Enter choice: 5 Enter a year: 2017 The World Series winner for the year 2017 has yet to be determined! Main Menu 1 - Show all winners - descending years 2 - Show all winners - ascending years 3 - Show how many times a particular team has won 4 - Show the years that a particular team has won 5 - Show the winner for a particular year 6 - Exit Enter choice: 5 Enter a year: 1994 The World Series was not played in 1994 Main Menu 1 - Show all winners - descending years 2 - Show all winners - ascending years 3 - Show how many times a particular team has won 4 - Show the years that a particular team has won 5 - Show the winner for a particular year 6 - Exit Enter choice: 2 World Series Winners: 1903 Boston Americans 1904 NO GAME PLAYED 1905 New York Giants 1906 Chicago White Sox 1907 Chicago Cubs 1908 Chicago Cubs 1909 Pittsburgh Pirates 1910 Philadelphia Athletics

// input for WorldSeries.txt

Chicago Cubs

Kansas City Royals

San Francisco Giants

Boston Red Sox

San Francisco Giants

St. Louis Cardinals

San Francisco Giants

New York Yankees

Philadelphia Phillies

Boston Red Sox

St. Louis Cardinals

Chicago White Sox

Boston Red Sox

Florida Marlins

Anaheim Angels

Arizona Diamondbacks

New York Yankees

New York Yankees

New York Yankees

Florida Marlins

New York Yankees

Atlanta Braves

NO GAME PLAYED

Toronto Blue Jays

Toronto Blue Jays

Minnesota Twins

Cincinnati Reds

Oakland Athletics

Los Angeles Dodgers

Minnesota Twins

New York Mets

Kansas City Royals

Detroit Tigers

Baltimore Orioles

St. Louis Cardinals

Los Angeles Dodgers

Philadelphia Phillies

Pittsburgh Pirates

New York Yankees

New York Yankees

Cincinnati Reds

Cincinnati Reds

Oakland Athletics

Oakland Athletics

Oakland Athletics

Pittsburgh Pirates

Baltimore Orioles

New York Mets

Detroit Tigers

St. Louis Cardinals

Baltimore Orioles

Los Angeles Dodgers

St. Louis Cardinals

Los Angeles Dodgers

New York Yankees

New York Yankees

Pittsburgh Pirates

Los Angeles Dodgers

New York Yankees

Milwaukee Braves

New York Yankees

Brooklyn Dodgers

New York Giants

New York Yankees

New York Yankees

New York Yankees

New York Yankees

New York Yankees

Cleveland Indians

New York Yankees

St. Louis Cardinals

Detroit Tigers

St. Louis Cardinals

New York Yankees

St. Louis Cardinals

New York Yankees

Cincinnati Reds

New York Yankees

New York Yankees

New York Yankees

New York Yankees

Detroit Tigers

St. Louis Cardinals

New York Giants

New York Yankees

St. Louis Cardinals

Philadelphia Athletics

Philadelphia Athletics

New York Yankees

New York Yankees

St. Louis Cardinals

Pittsburgh Pirates

Washington Senators

New York Yankees

New York Giants

New York Giants

Cleveland Indians

Cincinnati Reds

Boston Red Sox

Chicago White Sox

Boston Red Sox

Boston Red Sox

Boston Braves

Philadelphia Athletics

Boston Red Sox

Philadelphia Athletics

Philadelphia Athletics

Pittsburgh Pirates

Chicago Cubs

Chicago Cubs

Chicago White Sox

New York Giants

NO GAME PLAYED

Boston Americans

can you write this in java useing jGrasp?

sombody else did but did not fallow all the instructions and the data came out wrong

the parts that have main menu above them are sample runs that is what it is supsoe to look like when you imput data the person before only tested the first

2 and neglected the rest so the program did not run correctly can someone do this correctly take your time and if you need more info on something i will help but please dont make me waste all my questions for 1 problem thank you and good luck

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago