Create a project and class named Project3 in BlueJ. • Download the files "names.txt" and "wins.txt" and store it in your project folder. • Declare a two-dimensional (2D) String array with 10 rows and 2 columns. This array will be for the first and last names of each coach. • Declare a two-dimensional (2D) integer array with 10 rows and 2 columns. This array will be for the number of career wins and Stanley Cup championships of each coach. • Declare two Scanner objects, one associated with the names.txt file and the other associated with the wins.txt file. • Call the following methods: setNamesArray() - This method has two integer parameters (one for the rows of a two-dimensional array and the other for the columns of a two-dimensional array) and a Scanner parameter. The method will return a two-dimensional array of Strings with rows and columns given by the parameters. Each row of the array will have each coach’s first name in the first column and each coach’s last name in the second column. Any loops used must have an actual Boolean expression involving a relational operator (<, >, <=, >=, etc) and using either the “.length” feature or the integer parameters. setWinsArray() - This method has two integer parameters (one for the rows of a two-dimensional array and the other for the columns of a two-dimensional array) and a Scanner parameter. The method will return a two-dimensional array of integers with rows and columns given by the parameters. Each row of the array will have each coach’s career wins in the first column and each coach’s Stanley Cup championships in the second column. Any loops used must have an actual Boolean expression involving a relational operator (<, >, <=, >=, etc) and using either the “.length” feature or the integer parameters. mostCups() - This method returns a String and has two parameters: a two-dimensional array of Strings and a two-dimensional array of integers. The method will find the row index of the largest number of Stanley Cups in the array for wins and use this index to return a String containing the coach with the Stanley Cups and the number of Stanley Cups in a sentence. The “.length” feature must be used in an expression involving a relational operator in any loop conditions in this method. noCupsForYou() - This method is void and has two parameters: a two-dimensional array of Strings and a twodimensional array of integers. The method first display a header for the coaches who have not won the Stanley Cup. It will find all coaches who have not won the Stanley Cup and display their first and last names. The “.length” feature must be used in an expression involving a relational operator in any loop conditions in this method.
Here are the programming instructions for this project:
• Create a project and class named Project3 in BlueJ.
• Download the files "names.txt" and "wins.txt" and store it in your project folder.
• Declare a two-dimensional (2D) String array with 10 rows and 2 columns. This array will be for the first and last names of each coach.
• Declare a two-dimensional (2D) integer array with 10 rows and 2 columns. This array will be for the number of career wins and Stanley Cup championships of each coach.
• Declare two Scanner objects, one associated with the names.txt file and the other associated with the wins.txt file.
• Call the following methods:
- setNamesArray() - This method has two integer parameters (one for the rows of a two-dimensional array and the other for the columns of a two-dimensional array) and a Scanner parameter. The method will return a two-dimensional array of Strings with rows and columns given by the parameters. Each row of the array will have each coach’s first name in the first column and each coach’s last name in the second column. Any loops used must have an actual Boolean expression involving a relational operator (<, >, <=, >=, etc) and using either the “.length” feature or the integer parameters.
- setWinsArray() - This method has two integer parameters (one for the rows of a two-dimensional array and the other for the columns of a two-dimensional array) and a Scanner parameter. The method will return a two-dimensional array of integers with rows and columns given by the parameters. Each row of the array will have each coach’s career wins in the first column and each coach’s Stanley Cup championships in the second column. Any loops used must have an actual Boolean expression involving a relational operator (<, >, <=, >=, etc) and using either the “.length” feature or the integer parameters.
- mostCups() - This method returns a String and has two parameters: a two-dimensional array of Strings and a two-dimensional array of integers. The method will find the row index of the largest number of Stanley Cups in the array for wins and use this index to return a String containing the coach with the Stanley Cups and the number of Stanley Cups in a sentence. The “.length” feature must be used in an expression involving a relational operator in any loop conditions in this method.
- noCupsForYou() - This method is void and has two parameters: a two-dimensional array of Strings and a twodimensional array of integers. The method first display a header for the coaches who have not won the Stanley Cup. It will find all coaches who have not won the Stanley Cup and display their first and last names. The “.length” feature must be used in an expression involving a relational operator in any loop conditions in this method.
- Here is a sample output:
Scotty Bowman has the most career wins with 1244
Scotty Bowman has the most Stanley Cups with 9
The following coaches have not won the Stanely Cup:
Paul Maurice
Pat Quinn
Lindy Ruff
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images