Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your program should accept input that represents statistics for some number of baseball players, convert this input into an array of BaseballPlayer objects, and display


Your program should accept input that represents statistics for some number of baseball players, convert this input into an array ofBaseballPlayerobjects, and display specific results obtained by processing the array.

Input format:

Each line of the input will consist of six values that will be separated by a # character. The six values in order from left to right are:

Player Name (a String) Home Runs (an Integer) Batting Average (a Double) Base Hits (an Integer) Runs Batted In (an Integer) Stolen Bases (an Integer)

Here is an example:

Aaron, Hank # 755 # .305 # 3771 # 2297 # 240

Note that you should use the trim method of the String class to remove all leading and trailing spaces from the parts of the input line that you split using \"#\" as the delimiter before processing the values in your program.

Array of Objects:

You will need to define a class in your NetBeans project to represent Baseball Players. The class definition should have a private data member for each of the values shown above, a constructor method that accepts as many parameters as the class has private data members, a \"getter\" method for each private data member, and a toString method. The input data should be stored in an array of Baseball Player objects.

Results of Processing to Display

The following should be displayed in the output text area, separated by several blank lines for readability:

  1. all of the data in the input, on separate lines (display the result of the toString method, so that all data are shown in the output area)
  2. all players who have hit 520 home runs or more
  3. all players who have a batting average of .310 or higher
  4. the single player with the most RBIs of any player in the input

Input Samples to Use:

Your program should be able to process both of these inputs correctly:

  1. Top 60 Home Run Hitters of all time

Contents of file:

Aaron, Hank # 755 # .305 # 3771 # 2297 # 240

Bagwell, Jeff # 449 # .297 # 2314 # 1529 # 202

Banks, Ernie # 512 # .274 # 2583 # 1636 # 50

Beltre, Adrian # 477 # .286 # 3166 # 1707 # 121

Bonds, Barry # 762 # .298 # 2935 # 1996 # 514

Cabrera, Miguel # 502 # .310 # 2987 # 1804 # 39

Canseco, Jose # 462 # .266 # 1877 # 1407 # 200

Cruz, Nelson # 449 # .277 # 1913 # 1238 # 79

Dawson, Andre # 438 # .279 # 2774 # 1591 # 314

Delgado, Carlos # 473 # .280 # 2038 # 1512 # 14

Dunn, Adam # 462 # .237 # 1631 # 1168 # 63

Edmonds, Jim # 393 # .284 # 1949 # 1199 # 67

Evans, Darrell # 414 # .248 # 2223 # 1354 # 98

Foxx, Jimmie # 534 # .325 # 2646 # 1922 # 87

Galarraga, Andres # 399 # .288 # 2333 # 1425 # 128

Gehrig, Lou # 493 # .340 # 2721 # 1995 # 102

Giambi, Jason # 440 # .277 # 2010 # 1441 # 20

Gonzalez, Juan # 434 # .295 # 1936 # 1404 # 26

Griffey Jr., Ken # 630 # .284 # 2781 # 1836 # 184

Guerrero, Vladimir # 449 # .318 # 2590 # 1496 # 181

Jackson, Reggie # 563 # .262 # 2584 # 1702 # 228

Jones, Andruw # 434 # .254 # 1933 # 1289 # 152

Jones, Chipper # 468 # .303 # 2726 # 1623 # 150

Kaline, Al # 399 # .297 # 3007 # 1583 # 137

Killebrew, Harmon # 573 # .263 # 2086 # 1584 # 19

Kingman, Dave # 442 # .236 # 1575 # 1210 # 85

Konerko, Paul # 439 # .279 # 2340 # 1412 # 9

Mantle, Mickey # 536 # .298 # 2415 # 1509 # 153

Mathews, Eddie # 512 # .271 # 2315 # 1453 # 68

Mays, Willie # 660 # .302 # 3283 # 1903 # 338

McCovey, Willie # 521 # .270 # 2211 # 1555 # 26

McGriff, Fred # 493 # .284 # 2490 # 1550 # 72

McGwire, Mark # 583 # .263 # 1626 # 1414 # 12

Murphy, Dale # 398 # .265 # 2111 # 1266 # 161

Murray, Eddie # 504 # .287 # 3255 # 1917 # 110

Musial, Stan # 475 # .331 # 3630 # 1951 # 78

Nettles, Graig # 390 # .248 # 2225 # 1314 # 32

Ortiz, David # 541 # .286 # 2472 # 1768 # 17

Ott, Mel # 511 # .304 # 2876 # 1860 # 890

Palmeiro, Rafael # 569 # .288 # 3020 # 1835 # 97

Piazza, Mike # 427 # .308 # 2127 # 1335 # 17

Pujols, Albert # 679 # .297 # 3301 # 2150 # 116

Ramirez, Manny # 555 # .312 # 2574 # 1831 # 38

Ripken Jr., Cal # 431 # .276 # 3184 # 1695 # 36

Robinson, Frank # 586 # .294 # 2943 # 1812 # 204

Rodriguez, Alex # 696 # .295 # 3115 # 2086 # 329

Ruth, Babe # 714 # .342 # 2873 # 2213 # 123

Schmidt, Mike # 548 # .267 # 2234 # 1595 # 174

Sheffield, Gary # 509 # .292 # 2689 # 1676 # 253

Snider, Duke # 407 # .295 # 2116 # 1333 # 99

Soriano, Alfonso # 412 # .270 # 2095 # 1159 # 289

Sosa, Sammy # 609 # .273 # 2408 # 1667 # 234

Stargell, Willie # 475 # .282 # 2232 # 1540 # 17

Teixeira, Mark # 409 # .268 # 1862 # 1298 # 26

Thome, Jim # 612 # .276 # 2328 # 1699 # 19

Thomas, Frank # 521 # .301 # 2468 # 1704 # 32

Williams, Billy # 426 # .290 # 2711 # 1475 # 90

Williams, Ted # 521 # .344 # 2654 # 1839 # 24

Winfield, Dave # 465 # .283 # 3110 # 1833 # 223

Yastrzemski, Carl # 452 # .285 # 3419 # 1844 # 168

  1. Top 12 Batters of all time:

Contents of file:

Brouthers, Dennis # 106 # .342 # 2296 # 1296 # 256

Cobb, Ty # 117 # .367 # 4191 # 1938 # 892

Delahanty, Ed # 101 # .346 # 2596 # 1464 # 455

Hamilton, Billy # 40 # .344 # 2159 # 739 # 912

Heilmann, Harry # 183 # .342 # 2660 # 1539 # 113

Hornsby, Rogers # 301 # .358 # 2930 # 1584 # 135

Keeler, Willie # 33 # .341 # 2932 # 810 # 495

Ruth, Babe # 714 # .342 # 2873 # 2213 # 123

Sisler, Gene # 102 # .340 # 2812 # 1175 # 375

Speaker, Tris # 117 # .345 # 3515 # 1529 # 432

Terry, Bill # 154 # .341 # 2193 # 1078 # 56

Williams, Ted # 521 # .344 # 2654 # 1839 # 24




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

Starting Out With Java From Control Structures Through Data Structures

Authors: Tony Gaddis

6th Edition

0133957055, 978-0133957051

More Books

Students also viewed these Programming questions

Question

please try to give correct answer 2 4 3 .

Answered: 1 week ago

Question

3 > O Actual direct-labour hours Standard direct-labour hours...

Answered: 1 week ago