Description
You should create new folder for Part 3 and copy your relevant Part 2 source and optional test files to
it. You should create a jGRASP project with these files in it, and then add the new source and
optional test files as they are created.
Specifications – Use arrays in this project; ArrayLists are not allowed!
Overview: This project is Part 3 of three that involves the pay analysis and reporting for ball players.
In Part 1, you developed Java classes including an abstract BallPlayer class and subclasses of it that
represent categories of ball players: outfielders, infielders, pitchers, and relief pitchers. In Part 2, you
implemented three additional classes: (1) NameComparator that implements the Comparator interface
Project: Ball Players – Part 3 Page 2 of 11
Page 2 of 11
for BallPlayer, (2) EarningsComparator that implements the Comparator interface for BallPlayer, and
(3) BallTeam that represents a team of ball players and includes several specialized methods. In Part
3, you are to add exception handing and invalid input reporting. You will need to do the following:
(1) create a new class named InvalidCategoryException which extends the Exception class, (2) add
try-catch statements to catch FileNotFoundException in the main method of the BallPlayersPart3
class, and (3) modify the readBallPlayerFile in the BallTeam to catch/handle the
InvalidCategoryException, NumberFormatException, and NoSuchElementException in the event that
these exceptions are thrown while reading the input file.
Note that the main method in BallPlayersPart3 should create a BallTeam object and then invoke the
readBallPlayerFile method on the BallTeam object to read data from a file and add ball players to the
team. You can use BallPlayersPart3 in conjunction with interactions by running the program in the
canvas (or debugger with a breakpoint) and single stepping until the variables of interest are created.
You can then enter interactions in the usual way. You should create a jGRASP project upfront and
then add the source files as they are created. All your files should be in a single folder.
• BallPlayer, Outfielder, Infielder, Pitcher, ReliefPitcher, NameComparator,
EarningsComparator
Requirements and Design: No changes from the specifications in Part 1 and Part 2.
• InvalidCategoryException.java
Requirements and Design: InvalidCategoryException is a user defined exception created by
extending the Exception class. This exception is to be thrown and caught in the
readBallPlayerFile method in the BallTeam class when a line of input data contains an invalid
player category. The constructor for InvalidCategoryException takes a single String parameter
representing category and invokes the super constructor with the following String:
“For category: ” + “\”” + category + “\””
This string will be the toString() value of an InvalidCategoryException when it occurs. For a
similar constructor, see InvalidLengthException.java in 11_Exceptions\Examples\Polygons from
this week’s lecture notes.
• BallTeam.java
Requirements and Design: In addition to the specifications in Part 2, the existing
readBallPlayerFile method must be modified to recognize invalid input data and catch
InvalidCategoryException, NumberFormatException, and NoSuchElementException.
o readBallPlayerFile has no return value and accepts the data file name as a String
and throws FileNotFoundException. This method creates a Scanner object to read in the
file and then reads it in line by line. The first line contains the team name and each of the
remaining lines contains the data for a player. After reading in the team name, the
“player” lines should be processed as follows. A player line is read in, a second scanner
Project: Ball Players – Part 3 Page 3 of 11
Page 3 of 11
is created on the line, and the individual values for the player are read in. After the
values on the line have been read in, an “appropriate” BallPlayer object created. If there
is room on the roster, the player is added to the roster array and the player count is
incremented. Any player lines/records read from the file after the limit of
MAX_PLAYERS players has been reached should be added to the excluded array and its
count should be incremented. If excluded array is full, the line/record should just be
skipped. The data file is a “comma separated values” file; i.e., if a line contains multiple
values, the values are delimited by commas. So when you set up the scanner for the
player lines, you need to set the delimiter to use a “,”. Each player line in the file begins
with a category for the ball player (O, I, P, and R are valid categories for ball players
indicating Outfielder, Infielder, Pitcher, and ReliefPitcher respectively. For each
incorrect line scanned (i.e., a line of data contains an invalid category, invalid numeric
data, or missing data), your method will need to handle the invalid items properly. (1) If
the line of data begins with an invalid category, your program should throw an
InvalidCategoryException (see description above). (2) If a line of data has a valid
category, but includes invalid numeric data (e.g., the value for battingAvg contains an
alphabetic character), a NumberFormatException (see notes on last page) will be thrown
automatically by the Java Runtime Environment (JRE). (3) If a line of data has a valid
category, but has missing data (e.g., the value for battingAvg has been omitted), a
NoSuchElementException (see notes on last page) will be thrown automatically by the
Java Runtime Environment (JRE) Your readBallPlayerFile method should catch and
handle InvalidCategoryException, NumberFormatException, and
NoSuchElementException as follows. In each catch clause, a String object should be
created consisting of
e + ” in: ” + line
where e is the exception and line is the line with the invalid data. The String object
should be added to the excludedRecords array.
The file ball_player_data3a.csv is available for download from the course web site.
Below are example data records (the first line/record containing the team name is
followed by player lines/records):
Auburn Heavy Hitters
O,32,Pat Jones,RF,150000,.375,.950
I,23,Jackie Smith,3B,150000,2.50,.275,.850
P,43,Jo Williams,RHP,150000,3.50,.125,22,4,2.85
L,34,Sammi James,LHP,150000,3.50,.125,5,4,3.85,17
R,34,Sammi James,LHP,150000,3.50,.125,5,4,3.85,17
O, 9,Pat Williams,RF,150000,1.25,.34a,.950
• BallPlayersPart3.java
Requirements and Design: The BallPlayersPart3 class contains the main method for running the
program. In addition to the specifications in Part 2, the main method should be modified as
follows.
Project: Ball Players – Part 3 Page 4 of 11
Page 4 of 11
As before, main acquires the file name from args[0], creates an instance of BallTeam,
and then calls the readBallPlayerFile method in the BallTeam class to read in the data
file. After successfully reading in the file, main generates the five reports as shown in the
example output beginning on the next page. The main method should not include the
throws FileNotFoundException in the declaration. Instead, the main method should
include a try-catch statement to catch FileNotFoundException when/if it is thrown in the
readBallPlayerFile method in the BallTeam class. This exception will occur if an
incorrect file name is passed to the readBallPlayerFile method. This exception will be
propagated from readBallPlayerFile and caught in the main method. The catch block
should print a message (“*** Attempted to read file: ” along with the exception’s
message). For example, if the user entered “nofile.csv” as the command line argument
and this file does not exit, then the Run I/O in jGRASP would look like the second run in
the example output beginning on the next page.
Project: Ball Players – Part 3 Page 5 of 11
Page 5 of 11
Example Output
Output when no file name is passed to main in as a command line argument. —-jGRASP exec: java BallPlayersPart3
File name expected as command line argument.
Program ending.
—-jGRASP: operation complete.
Output when a bad file name is passed to main in as a command line argument. —-jGRASP exec: java BallPlayersPart3 bad_file_name.cvs
*** Attempted to read file: java.io.FileNotFoundException: bad_file_name.cvs (No such file or directory)
—-jGRASP: operation complete.
Output when ball_player_data3a.csv is passed to main in as a command line argument. —-jGRASP exec: java BallPlayersPart3 ball_player_data3a.csv
—————————————
Team Report for Auburn Heavy Hitters
—————————————
23 Jackie Smith (3B) .275
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.5
Total Earnings: $237,656.25 (class Infielder)
43 Jo Williams (RHP) 22 wins, 4 losses, 2.85 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 3.5
Total Earnings: $248,181.82 (class Pitcher)
34 Sammi James (LHP) 5 wins, 4 losses, 17 saves, 3.85 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 3.5
Total Earnings: $214,948.45 (class ReliefPitcher)
—————————————
Team Report for Auburn Heavy Hitters (by Number)
—————————————
23 Jackie Smith 3B .275
34 Sammi James LHP 5 wins, 4 losses, 17 saves, 3.85 ERA
43 Jo Williams RHP 22 wins, 4 losses, 2.85 ERA
—————————————
Team Report for Auburn Heavy Hitters (by Name)
—————————————
34 Sammi James LHP 5 wins, 4 losses, 17 saves, 3.85 ERA
23 Jackie Smith 3B .275
43 Jo Williams RHP 22 wins, 4 losses, 2.85 ERA
—————————————
Team Report for Auburn Heavy Hitters (by Earnings)
—————————————
$248,181.82 43 Jo Williams RHP 22 wins, 4 losses, 2.85 ERA
$237,656.25 23 Jackie Smith 3B .275
$214,948.45 34 Sammi James LHP 5 wins, 4 losses, 17 saves, 3.85 ERA
—————————————
Excluded Records Report
—————————————
java.util.NoSuchElementException in: O,32,Pat Jones,RF,150000,.375,.950
InvalidCategoryException: For category: “L” in: L,34,Sammi James,LHP,150000,3.50,.125,5,4,3.85,17
java.lang.NumberFormatException: For input string: “.34a” in: O, 9,Pat Williams,RF,150000,1.25,.34a,.950
—-jGRASP: operation complete.
Output when ball_player_data3b.csv is passed to main in as a command line argument.
Project: Ball Players – Part 3 Page 6 of 11
Page 6 of 11
—-jGRASP exec: java BallPlayersPart3 ball_player_data3b.csv
—————————————
Team Report for My Test Team
—————————————
21 John Doe (RF) .200
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $217,620.00 (class Outfielder)
11 Tim Dobbs (RF) .350
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $244,566.00 (class Outfielder)
13 Jim Dobbs (LF) .278
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $213,948.00 (class Outfielder)
12 Joey Ledet (LF) .325
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.1
Total Earnings: $231,728.00 (class Outfielder)
14 Sruthi Yalamanchili (CF) .285
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $226,351.50 (class Outfielder)
15 Kavyashree Krishnappa (CF) .298
Base Salary: $140,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $209,839.28 (class Outfielder)
29 Sanket Chintapalli (1B) .200
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $217,620.00 (class Infielder)
17 Jane Doe (1B) .350
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $244,566.00 (class Infielder)
18 Buddy Bell (2B) .325
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.1
Total Earnings: $248,280.00 (class Infielder)
19 Oscar De La Hoya (2B) .278
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $213,948.00 (class Infielder)
20 David Umphress (3B) .285
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $226,351.50 (class Infielder)
10 Mikie Mahtook (3B) .298
Base Salary: $140,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $209,839.28 (class Infielder)
22 Matty Ott (SS) .200
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $217,620.00 (class Infielder)
23 Louis Coleman (SS) .350
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $244,566.00 (class Infielder)
25 Aaron Nola (RHP) 5 wins, 11 losses, 1.3 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $110,782.61 (class Pitcher)
26 John Malkovic (RHP) 6 wins, 10 losses, 1.4 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $131,000.00 (class Pitcher)
27 Louis Giglio (RHP) 7 wins, 9 losses, 1.5 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $131,936.00 (class Pitcher)
28 Gus Malzan (LHP) 8 wins, 8 losses, 1.6 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $150,000.00 (class Pitcher)
16 Tim Brando (LHP) 9 wins, 7 losses, 1.7 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $149,125.93 (class Pitcher)
30 Todd Strange (LHP) 10 wins, 6 losses, 2 saves, 1.8 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.1
Project: Ball Players – Part 3 Page 7 of 11
Page 7 of 11
Total Earnings: $172,500.00 (class ReliefPitcher)
31 Blake Dean (RHP) 11 wins, 5 losses, 3 saves, 1.9 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $168,965.52 (class ReliefPitcher)
32 Brian Wilson (RHP) 12 wins, 4 losses, 4 saves, 2.0 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $188,000.00 (class ReliefPitcher)
33 Johnny Manziel (RHP) 21 wins, 3 losses, 2 saves, 2.1 ERA
Base Salary: $170,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $235,806.45 (class ReliefPitcher)
34 Green Lantern (LHP) 14 wins, 2 losses, 3 saves, 2.2 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $203,906.25 (class ReliefPitcher)
—————————————
Team Report for My Test Team (by Number)
—————————————
10 Mikie Mahtook 3B .298
11 Tim Dobbs RF .350
12 Joey Ledet LF .325
13 Jim Dobbs LF .278
14 Sruthi Yalamanchili CF .285
15 Kavyashree Krishnappa CF .298
16 Tim Brando LHP 9 wins, 7 losses, 1.7 ERA
17 Jane Doe 1B .350
18 Buddy Bell 2B .325
19 Oscar De La Hoya 2B .278
20 David Umphress 3B .285
21 John Doe RF .200
22 Matty Ott SS .200
23 Louis Coleman SS .350
25 Aaron Nola RHP 5 wins, 11 losses, 1.3 ERA
26 John Malkovic RHP 6 wins, 10 losses, 1.4 ERA
27 Louis Giglio RHP 7 wins, 9 losses, 1.5 ERA
28 Gus Malzan LHP 8 wins, 8 losses, 1.6 ERA
29 Sanket Chintapalli 1B .200
30 Todd Strange LHP 10 wins, 6 losses, 2 saves, 1.8 ERA
31 Blake Dean RHP 11 wins, 5 losses, 3 saves, 1.9 ERA
32 Brian Wilson RHP 12 wins, 4 losses, 4 saves, 2.0 ERA
33 Johnny Manziel RHP 21 wins, 3 losses, 2 saves, 2.1 ERA
34 Green Lantern LHP 14 wins, 2 losses, 3 saves, 2.2 ERA
—————————————
Team Report for My Test Team (by Name)
—————————————
18 Buddy Bell 2B .325
16 Tim Brando LHP 9 wins, 7 losses, 1.7 ERA
29 Sanket Chintapalli 1B .200
23 Louis Coleman SS .350
19 Oscar De La Hoya 2B .278
31 Blake Dean RHP 11 wins, 5 losses, 3 saves, 1.9 ERA
13 Jim Dobbs LF .278
11 Tim Dobbs RF .350
17 Jane Doe 1B .350
21 John Doe RF .200
27 Louis Giglio RHP 7 wins, 9 losses, 1.5 ERA
15 Kavyashree Krishnappa CF .298
34 Green Lantern LHP 14 wins, 2 losses, 3 saves, 2.2 ERA
12 Joey Ledet LF .325
10 Mikie Mahtook 3B .298
26 John Malkovic RHP 6 wins, 10 losses, 1.4 ERA
28 Gus Malzan LHP 8 wins, 8 losses, 1.6 ERA
33 Johnny Manziel RHP 21 wins, 3 losses, 2 saves, 2.1 ERA
25 Aaron Nola RHP 5 wins, 11 losses, 1.3 ERA
22 Matty Ott SS .200
30 Todd Strange LHP 10 wins, 6 losses, 2 saves, 1.8 ERA
20 David Umphress 3B .285
32 Brian Wilson RHP 12 wins, 4 losses, 4 saves, 2.0 ERA
14 Sruthi Yalamanchili CF .285
—————————————
Team Report for My Test Team (by Earnings)
—————————————
$248,280.00 18 Buddy Bell 2B .325
$244,566.00 11 Tim Dobbs RF .350
$244,566.00 17 Jane Doe 1B .350
$244,566.00 23 Louis Coleman SS .350
$235,806.45 33 Johnny Manziel RHP 21 wins, 3 losses, 2 saves, 2.1 ERA
$231,728.00 12 Joey Ledet LF .325
Project: Ball Players – Part 3 Page 8 of 11
Page 8 of 11
$226,351.50 14 Sruthi Yalamanchili CF .285
$226,351.50 20 David Umphress 3B .285
$217,620.00 21 John Doe RF .200
$217,620.00 29 Sanket Chintapalli 1B .200
$217,620.00 22 Matty Ott SS .200
$213,948.00 13 Jim Dobbs LF .278
$213,948.00 19 Oscar De La Hoya 2B .278
$209,839.28 15 Kavyashree Krishnappa CF .298
$209,839.28 10 Mikie Mahtook 3B .298
$203,906.25 34 Green Lantern LHP 14 wins, 2 losses, 3 saves, 2.2 ERA
$188,000.00 32 Brian Wilson RHP 12 wins, 4 losses, 4 saves, 2.0 ERA
$172,500.00 30 Todd Strange LHP 10 wins, 6 losses, 2 saves, 1.8 ERA
$168,965.52 31 Blake Dean RHP 11 wins, 5 losses, 3 saves, 1.9 ERA
$150,000.00 28 Gus Malzan LHP 8 wins, 8 losses, 1.6 ERA
$149,125.93 16 Tim Brando LHP 9 wins, 7 losses, 1.7 ERA
$131,936.00 27 Louis Giglio RHP 7 wins, 9 losses, 1.5 ERA
$131,000.00 26 John Malkovic RHP 6 wins, 10 losses, 1.4 ERA
$110,782.61 25 Aaron Nola RHP 5 wins, 11 losses, 1.3 ERA
—————————————
Excluded Records Report
—————————————
java.lang.NumberFormatException: For input string: “1.9a” in: R,32,Brian William,RHP,150000,1.9a,0.285,12,4,2,4
java.util.NoSuchElementException in: R,33,Johnny Madman,RHP,140000,1.8
java.lang.NumberFormatException: For input string: “14c” in: R,34,Green Monster,LHP,150000,2.3,0.2,14c,2,2.2,3
java.lang.NumberFormatException: For input string: “1d” in: R,35,Bruce Wellburn,LHP,140000,2.2,0.35,15,1d,2.3,4
java.util.NoSuchElementException in: P,36,Bull Durham,LHP,150000,2.1,0.325,16,0
java.lang.NumberFormatException: For input string: “2f” in: R,36,Bill Getts,LHP,150000,2.1,0.325,16,0,2.4,2f
InvalidCategoryException: For category: “H” in: H,24,Austin Nola,LHP,150000,2.1,0.325,4,12,1.2
R,35,Bruce Wayne,LHP,140000,2.2,0.35,15,1,2.3,4
R,36,Bill Gates,LHP,150000,2.1,0.325,16,0,2.4,2
—-jGRASP: operation complete.
Output when ball_player_data3c.csv is passed to main in as a command line argument. —-jGRASP exec: java BallPlayersPart3 ball_player_data3c.csv
—————————————
Team Report for My Test Team
—————————————
21 John Doe (RF) .200
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $217,620.00 (class Outfielder)
11 Tim Dobbs (RF) .350
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $244,566.00 (class Outfielder)
13 Jim Dobbs (LF) .278
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $213,948.00 (class Outfielder)
12 Joey Ledet (LF) .325
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.1
Total Earnings: $231,728.00 (class Outfielder)
14 Sruthi Yalamanchili (CF) .285
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $226,351.50 (class Outfielder)
15 Kavyashree Krishnappa (CF) .298
Base Salary: $140,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $209,839.28 (class Outfielder)
29 Sanket Chintapalli (1B) .200
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $217,620.00 (class Infielder)
17 Jane Doe (1B) .350
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $244,566.00 (class Infielder)
18 Buddy Bell (2B) .325
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.1
Total Earnings: $248,280.00 (class Infielder)
19 Oscar De La Hoya (2B) .278
Project: Ball Players – Part 3 Page 9 of 11
Page 9 of 11
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $213,948.00 (class Infielder)
20 David Umphress (3B) .285
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $226,351.50 (class Infielder)
10 Mikie Mahtook (3B) .298
Base Salary: $140,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $209,839.28 (class Infielder)
22 Matty Ott (SS) .200
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $217,620.00 (class Infielder)
23 Louis Coleman (SS) .350
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $244,566.00 (class Infielder)
25 Aaron Nola (RHP) 5 wins, 11 losses, 1.3 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $110,782.61 (class Pitcher)
26 John Malkovic (RHP) 6 wins, 10 losses, 1.4 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $131,000.00 (class Pitcher)
27 Louis Giglio (RHP) 7 wins, 9 losses, 1.5 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $131,936.00 (class Pitcher)
28 Gus Malzan (LHP) 8 wins, 8 losses, 1.6 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $150,000.00 (class Pitcher)
16 Tim Brando (LHP) 9 wins, 7 losses, 1.7 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.2
Total Earnings: $149,125.93 (class Pitcher)
30 Todd Strange (LHP) 10 wins, 6 losses, 2 saves, 1.8 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.1
Total Earnings: $172,500.00 (class ReliefPitcher)
31 Blake Dean (RHP) 11 wins, 5 losses, 3 saves, 1.9 ERA
Base Salary: $140,000.00 Bonus Adjustment Factor: 2.0
Total Earnings: $168,965.52 (class ReliefPitcher)
32 Brian Wilson (RHP) 12 wins, 4 losses, 4 saves, 2.0 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 1.9
Total Earnings: $188,000.00 (class ReliefPitcher)
33 Johnny Manziel (RHP) 21 wins, 3 losses, 2 saves, 2.1 ERA
Base Salary: $170,000.00 Bonus Adjustment Factor: 1.8
Total Earnings: $235,806.45 (class ReliefPitcher)
34 Green Lantern (LHP) 14 wins, 2 losses, 3 saves, 2.2 ERA
Base Salary: $150,000.00 Bonus Adjustment Factor: 2.3
Total Earnings: $203,906.25 (class ReliefPitcher)
—————————————
Team Report for My Test Team (by Number)
—————————————
10 Mikie Mahtook 3B .298
11 Tim Dobbs RF .350
12 Joey Ledet LF .325
13 Jim Dobbs LF .278
14 Sruthi Yalamanchili CF .285
15 Kavyashree Krishnappa CF .298
16 Tim Brando LHP 9 wins, 7 losses, 1.7 ERA
17 Jane Doe 1B .350
18 Buddy Bell 2B .325
19 Oscar De La Hoya 2B .278
20 David Umphress 3B .285
21 John Doe RF .200
22 Matty Ott SS .200
23 Louis Coleman SS .350
25 Aaron Nola RHP 5 wins, 11 losses, 1.3 ERA
26 John Malkovic RHP 6 wins, 10 losses, 1.4 ERA
27 Louis Giglio RHP 7 wins, 9 losses, 1.5 ERA
28 Gus Malzan LHP 8 wins, 8 losses, 1.6 ERA
29 Sanket Chintapalli 1B .200
30 Todd Strange LHP 10 wins, 6 losses, 2 saves, 1.8 ERA
31 Blake Dean RHP 11 wins, 5 losses, 3 saves, 1.9 ERA
Project: Ball Players – Part 3 Page 10 of
11
Page 10 of 11
32 Brian Wilson RHP 12 wins, 4 losses, 4 saves, 2.0 ERA
33 Johnny Manziel RHP 21 wins, 3 losses, 2 saves, 2.1 ERA
34 Green Lantern LHP 14 wins, 2 losses, 3 saves, 2.2 ERA
—————————————
Team Report for My Test Team (by Name)
—————————————
18 Buddy Bell 2B .325
16 Tim Brando LHP 9 wins, 7 losses, 1.7 ERA
29 Sanket Chintapalli 1B .200
23 Louis Coleman SS .350
19 Oscar De La Hoya 2B .278
31 Blake Dean RHP 11 wins, 5 losses, 3 saves, 1.9 ERA
13 Jim Dobbs LF .278
11 Tim Dobbs RF .350
17 Jane Doe 1B .350
21 John Doe RF .200
27 Louis Giglio RHP 7 wins, 9 losses, 1.5 ERA
15 Kavyashree Krishnappa CF .298
34 Green Lantern LHP 14 wins, 2 losses, 3 saves, 2.2 ERA
12 Joey Ledet LF .325
10 Mikie Mahtook 3B .298
26 John Malkovic RHP 6 wins, 10 losses, 1.4 ERA
28 Gus Malzan LHP 8 wins, 8 losses, 1.6 ERA
33 Johnny Manziel RHP 21 wins, 3 losses, 2 saves, 2.1 ERA
25 Aaron Nola RHP 5 wins, 11 losses, 1.3 ERA
22 Matty Ott SS .200
30 Todd Strange LHP 10 wins, 6 losses, 2 saves, 1.8 ERA
20 David Umphress 3B .285
32 Brian Wilson RHP 12 wins, 4 losses, 4 saves, 2.0 ERA
14 Sruthi Yalamanchili CF .285
—————————————
Team Report for My Test Team (by Earnings)
—————————————
$248,280.00 18 Buddy Bell 2B .325
$244,566.00 11 Tim Dobbs RF .350
$244,566.00 17 Jane Doe 1B .350
$244,566.00 23 Louis Coleman SS .350
$235,806.45 33 Johnny Manziel RHP 21 wins, 3 losses, 2 saves, 2.1 ERA
$231,728.00 12 Joey Ledet LF .325
$226,351.50 14 Sruthi Yalamanchili CF .285
$226,351.50 20 David Umphress 3B .285
$217,620.00 21 John Doe RF .200
$217,620.00 29 Sanket Chintapalli 1B .200
$217,620.00 22 Matty Ott SS .200
$213,948.00 13 Jim Dobbs LF .278
$213,948.00 19 Oscar De La Hoya 2B .278
$209,839.28 15 Kavyashree Krishnappa CF .298
$209,839.28 10 Mikie Mahtook 3B .298
$203,906.25 34 Green Lantern LHP 14 wins, 2 losses, 3 saves, 2.2 ERA
$188,000.00 32 Brian Wilson RHP 12 wins, 4 losses, 4 saves, 2.0 ERA
$172,500.00 30 Todd Strange LHP 10 wins, 6 losses, 2 saves, 1.8 ERA
$168,965.52 31 Blake Dean RHP 11 wins, 5 losses, 3 saves, 1.9 ERA
$150,000.00 28 Gus Malzan LHP 8 wins, 8 losses, 1.6 ERA
$149,125.93 16 Tim Brando LHP 9 wins, 7 losses, 1.7 ERA
$131,936.00 27 Louis Giglio RHP 7 wins, 9 losses, 1.5 ERA
$131,000.00 26 John Malkovic RHP 6 wins, 10 losses, 1.4 ERA
$110,782.61 25 Aaron Nola RHP 5 wins, 11 losses, 1.3 ERA
—————————————
Excluded Records Report
—————————————
java.lang.NumberFormatException: For input string: “1.9a” in: R,32,Brian William,RHP,150000,1.9a,0.285,12,4,2,4
java.util.NoSuchElementException in: R,33,Johnny Madman,RHP,140000,1.8
java.lang.NumberFormatException: For input string: “2.2” in: R,34,Green Monster,LHP,150000,2.3,0.2,2,2.2,3
java.lang.NumberFormatException: For input string: “1d” in: R,35,Bruce Wellburn,LHP,140000,2.2,0.35,15,1d,2.3,4
java.util.NoSuchElementException in: P,36,Bull Durham,LHP,150000,2.1,0.325,16,0
java.lang.NumberFormatException: For input string: “2f” in: R,36,Bill Getts,LHP,150000,2.1,0.325,16,0,2.4,2f
InvalidCategoryException: For category: “H” in: H,24,Austin Nola,LHP,150000,2.1,0.325,4,12,1.2
R,35,Bruce Wayne,LHP,140000,2.2,0.35,15,1,2.3,4
R,36,Bill Gates,LHP,150000,2.1,0.325,16,0,2.4,2
O,21,John Dogget,RF,150000,2.3,0.2,0.98
O,11,Tim Dobber,RF,140000,2.2,0.35,0.97
O,13,Jack Dotson,LF,140000,2,0.278,0.95
O,12,Joey Lemon,LF,150000,2.1,0.325,0.96
O,14,Sruthi Jain,CF,150000,1.9,0.285,0.94
O,15,Kavyashree Jain,CF,140000,1.8,0.298,0.93
I,29,Sanket Chinti,1B,150000,2.3,0.2,0.98
I,17,John Doe,1B,140000,2.2,0.35,0.97
I,18,Buddy Bellsom,2B,150000,2.1,0.325,0.96
I,19,Jaime De La Hoya,2B,140000,2,0.278,0.95
Project: Ball Players – Part 3 Page 11 of
11
Page 11 of 11
I,20,David Palmer,3B,150000,1.9,0.285,0.94
I,10,Mikie Mahtookie,3B,140000,1.8,0.298,0.93
I,22,Matty Otter,SS,150000,2.3,0.2,0.98
I,23,Louis Cole,SS,140000,2.2,0.35,0.97
InvalidCategoryException: For category: “H” in: H,24,Austin Nolan,LHP,150000,2.1,0.325,4,12,1.2
P,25,Aaron Nolan,RHP,140000,2,0.278,5,11,1.3
P,26,John Palkovic,RHP,150000,1.9,0.285,6,10,1.4
P,27,Louis Biglio,RHP,140000,1.8,0.298,7,9,1.5
P,28,Gus Malson,LHP,150000,2.3,0.2,8,8,1.6
P,16,Tim Brandies,LHP,140000,2.2,0.35,9,7,1.7
O,21,John Dogget,RF,150000,2.3,0.2,0.98
—-jGRASP: operation complete.
Notes:
1. This project assumes that you are reading each double or int value as String using next() and then
parsing it into a double with Double.parseDouble(…) or into an int with Integer.parseInt(…) as shown
in the following examples.
. . . Double.parseDouble(myInput.next());
. . . Integer.parseInt(myInput.next());
This form of input will throw a java.lang.NumberFormatException if the value is not a double.
If you are reading in each double value as a double using nextDouble(), for example
. . . myInput.nextDouble();
then a java.util.InputMismatchException will be thrown if the value read is not a double.
For this project, you must use Double.parseDouble(…) or Integer.parseInt(…) to input a double or int
value respectively since Web-CAT is expecting NumberFormatException when an input String
cannot be converted to double or int value.
2. In the readBallPlayerFile method, for the default case (or else), which detects an invalid category, the
only statement should be:
throw new InvalidCategoryException(category);
The code that was in this block in Part 2 should be moved to the catch block for
InvalidCategoryException with any changes specified for Part 3.