The assignment will be graded out of 100 points.
All tasks ask you to write code, and specify what name to use for the file where you save that code. You need to use exactly the name that is given (do not change the case, or make any other modification). Remember, the name of the main class must match the filename.
Complete that program, by defining a print_player_info function, that satisfies the following specs:
data is a 2D string array containing the data of the nba.txt spreadsheet. Argument player is a string.
player (also in its lower-case version). For all such rows, it prints the statistics of the corresponding player.
Hints:
String.toLowerCase method. For example, the following code sets string s2 equal to "apple".
String s1 = "AppLE"; String s2 = s1.toLowerCase();
String y1 = s1.toLowerCase();
String y2 = s2.toLowerCase();
if (y2.indexOf(y1) != -1)
{
// code here for the case where s2 is part of s1.
}
System.out.printf("%20s: %s\n", ...
read_spreadsheet from program nba_leaders_2d_array_version.java (posted on the course website) can be useful here.
Enter part of a player's name (or q to quit): bryant
Enter part of a player's name (or q to quit): jord
player: Jordan Hill
games played: 70
minutes per game: 26.8
points: 12.0
field goals made: 5.1
field goal attempts: 11.1
field goal percentage: 45.9
3-pointers made: 0
3-pointers attempted: 0.2
3-pointer percentage: 27.3
free throws made: 1.8
free throws made: 2.4
free throws made: 73.8
rebounds: 2.5
assists: 5.5
steals: 7.9
blocks: 1.5
player: Jordan Clarkson
games played: 59
minutes per game: 25
points: 11.9
field goals made: 4.5
field goal attempts: 10.1
field goal percentage: 44.8
3-pointers made: 0.6
3-pointers attempted: 2.1
3-pointer percentage: 31.4
free throws made: 2.2
free throws made: 2.7
free throws made: 82.9
rebounds: 0.9
assists: 2.3
steals: 3.2
blocks: 3.5
player: DeAndre Jordan
games played: 82
minutes per game: 34.4
points: 11.5
field goals made: 4.6
field goal attempts: 6.5
field goal percentage: 71
3-pointers made: 0
3-pointers attempted: 0
3-pointer percentage: 25
free throws made: 2.3
free throws made: 5.7
free throws made: 39.7
rebounds: 4.8
assists: 10.1
steals: 15
blocks: 0.7
Enter part of a player's name (or q to quit): ebro
player: LeBron James
games played: 69
minutes per game: 36.1
points: 25.3
field goals made: 9
field goal attempts: 18.5
field goal percentage: 48.8
3-pointers made: 1.7
3-pointers attempted: 4.9
3-pointer percentage: 35.4
free throws made: 5.4
free throws made: 7.7
free throws made: 71
rebounds: 6
assists: 7.4
steals: 1.6
blocks: 0.7
Enter part of a player's name (or q to quit): westbrook
player: Russell Westbrook
games played: 67
minutes per game: 34.4
points: 28.1
field goals made: 9.4
field goal attempts: 22
field goal percentage: 42.6
3-pointers made: 1.3
3-pointers attempted: 4.3
3-pointer percentage: 29.9
free throws made: 8.1
free throws made: 9.8
free throws made: 83.5
rebounds: 7.3
assists: 8.6
steals: 2.1
blocks: 0.2
Enter part of a player's name (or q to quit): q
Exiting...
Your program's output should match EXACTLY the format shown above. There should be no deviations, no extra spaces or lines, no extra punctuation in your output. What you see above as uppercase letters should remain uppercase in your output, what you see as lowercase letters should remain as lowercase in your output, what you see as spaces and punctuation should remain exactly as spaces and punctuation in your output.
File task2.java contains an incomplete program. The goal of the program is to help users search for statistics of a specific player, stored in file nba.txt, and save them to an output file called out4.txt. In particular:
Complete that program, by defining a save_player_info function, that satisfies the following specs:
data is a 2D string array containing the data of the nba.txt spreadsheet. Argument player is a string.
player (also in its lower-case version). For all such rows, it saves the statistics of the corresponding player in file out4.txt
An example run of the complete program is shown below.
0: John, 2-3151
1: Mary, 6-1231
2: Bill, 8-9535
3: Ann, 3-1982
4: Pam, 2-3535
5: Jack, 2-6423
6: Will, 2-6442
7: Jake, 5-5555
1: Print phonebook.
2: Input a new entry.
3: Search by name.
q: Quit program.
Please enter an option: 2
Enter a name: Darth Vader
Enter a number: 43234123
1: Print phonebook.
2: Input a new entry.
3: Search by name.
q: Quit program.
Please enter an option: 2
Enter a name: Han Solo
Enter a number: 533412
1: Print phonebook.
2: Input a new entry.
3: Search by name.
q: Quit program.
Please enter an option: 1
0: John, 2-3151
1: Mary, 6-1231
2: Bill, 8-9535
3: Ann, 3-1982
4: Pam, 2-3535
5: Jack, 2-6423
6: Will, 2-6442
7: Jake, 5-5555
8: Darth Vader, 43234123
9: Han Solo, 533412
1: Print phonebook.
2: Input a new entry.
3: Search by name.
q: Quit program.
Please enter an option: 3
Enter part of the name: ann
Ann: 3-1982
1: Print phonebook.
2: Input a new entry.
3: Search by name.
q: Quit program.
Please enter an option: 3
Enter part of the name: an
Ann: 3-1982
Han Solo: 533412
1: Print phonebook.
2: Input a new entry.
3: Search by name.
q: Quit program.
Please enter an option: q
Your program's output should match EXACTLY the format shown above. There should be no deviations, no extra spaces or lines, no extra punctuation in your output. What you see above as uppercase letters should remain uppercase in your output, what you see as lowercase letters should remain as lowercase in your output, what you see as spaces and punctuation should remain exactly as spaces and punctuation in your output.
The assignment should be submitted via Blackboard. Submit a ZIPPED directory called assignment10.zip (no other forms of compression accepted, contact the instructor or TA if you do not know how to produce .zip files).
To create a zipped directory called assignment10.zip, follow these steps: