Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INTRODUCTION TO BASEBALL STATISTICS Hitting Statistics - for example, see the http://www.espn.com/mlb/team/stats/batting/_/name/nyy/seasontype/2: Name of hitter At bats (AB) - a whole number Runs scored (R)

INTRODUCTION TO BASEBALL STATISTICS

Hitting Statistics - for example, see the http://www.espn.com/mlb/team/stats/batting/_/name/nyy/seasontype/2:

Name of hitter

At bats (AB) - a whole number

Runs scored (R) - a whole number

Hits (H) - a whole number

Home runs (HR) - a whole number

Runs batted in (RBI) - a whole number

Batting Average (AVG or BA) - a real number 0.000 - 1.000, calculated as H/AB

Pitching Statistics - for example, see http://www.espn.com/mlb/team/stats/batting/_/name/nyy/seasontype/2

Name of pitcher

Wins (W) - a whole number

Losses (L) - a whole number

Runs allowed (R) - a whole number

Earned run average (ERA) - a real number

Each team has many hitters and pitchers over the course of a single season who contribute to the statistics for that team. Team statistics of interest to us are listed below.

Team Statistics

Location of team (ex: New York)

Nickname of team (ex: Yankees)

Wins (W) - sum of all team's pitchers' wins

Losses (L) - sum of all team's pitchers' losses

Winning Percentage (PCT) - a real number 0.000 - 1.000, equals W/(W + L)

Runs scored (RS) - sum of all team's hitters' runs scored

Runs allowed (RA) - sum of all team's pitchers' runs allowed

In addition to the team statistics listed above, for this assignment we are interested in the "Pythagorean Theorem of Baseball", a calculation created by baseball statistician Bill James for predicting a team's winning percentage based on that team's Runs Scored and Runs Allowed. This predictive winning percentage is calculated as: Pythagorean Winning Percentage = RS2/(RS2 + RA2) For this assignment, you will define classes to manage and analyze these statistics, and I will provide a skeleton for a driver (which you will complete) for testing them.

Before you write any code for this assignment, you should model your classes by creating a UML class diagram. I recommend using VioletUML, which is easy to use to draw your diagram. Note that your design will be rather simple, but you will have to consider all data and methods your classes must make available. Note that there are many tutorials available on the basics of UML class diagrams. Your diagram should map out the following classes and include relationships between them:

BaseballHitter

Data - this class should use complete information hiding (i.e. make its instance variables private) to store all data about hitters previously discussed. Note that no redundant data should be stored. Any data derived from other data should use a method rather than an instance variable.

Accessor and mutator methods - should be provided for all changeable data

Constructors - at least one constructor should be provided that allows for the initialization of all instance variables (see HW5Driver for use)

toString method - should summarize this object such that it may display all stats in a neat format (like a row in a table)

BaseballPitcher

Data - should use complete information hiding to store all pitcher data previously discussed.

Accessor and mutator methods - should be provided for all changeable data

Constructors - at least one constructor should be provided that allows for the initialization of all instance variables (see HW5Driver for use)

toString method - should summarize this object such that it may display all stats in a neat format (like a row in a table)

BaseballTeam

Data - should use complete information hiding to store to store two arrays, one for the team's hitters, one for the team's pitchers

Accessor and mutator methods - should be provided for all changeable data

This should include a means to add hitters (addHitter) & pitchers (addPitcher) to a team

sort method

This should provide a means for the sorting of hitters using the Bubble Sort algorithm (see class notes) by name (A-Z), at bats (descending), runs (descending), hits (descending), home runs (descending), runs batted in (descending), or batting average (descending). This method should accept a method argument that selects the sorting criteria, meaning the argument tells the method how to sort.

This class should provide a means for the sorting of pitchers using Selection Sort by name (A-Z), wins (descending), losses(descending), runs (descending), and era (ascending).

toString method - should summarize this object such that it may display all stats in a neat form, including all hitters and pitchers in tables. For example, depending on when your statistics were updated, the toString method for the 2018 New York Yankees and then the New York Mets might produce the text below.

Notice that RS & RA values are calculated by summing the Runs Scored by hitters and Runs Allowed by pitchers

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

What are the most important qualifications? Personal qualities?

Answered: 1 week ago

Question

Which personal relationships influenced you the most?

Answered: 1 week ago

Question

What were your most important educational experiences?

Answered: 1 week ago

Question

How was your life influenced by those events?

Answered: 1 week ago