Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description ( JAVA ) Create a class called BowlingScores. It will use an attribute which is an array. The array will have 1 6 slots,
Description JAVA
Create a class called BowlingScores. It will use an attribute which is an array. The array will have slots, one for each team in a team bowling league. The value in each slot will be the total for all bowlers on the team for a game series.
Your constructor will create the array and read a file whose name is the input parameter of the method. The file will contain four columns of data, separated by tabs The first column is the team number The next three columns of each line is the score of each game for a member of that team. All the results of the team will be togheter, meaning they will appear in consecutive lines in the file. Each team has four players, but sometimes only three may play. In the case that a player was absent and a team has only three lines of results, the fourth player was treated as a "blind", who will score points for each game..
The file will not have the team results in numerical order. Instead, the two teams who played each otehr will be right after the other. For instance, if Team played Team the four lines of results for Team will immediately follow the four lines for Team
Lopp through the file, reading each line. Remember that you main have only three lines for a particular team, so do not automatically read four lines for a team. Total up all of the games inscluding the scores for a "blind" and place that total into the appropriate slot of the array Team s scores go into index Team s scores into index etc Keep track of which team played which. You can use whatever structure you wish in order to do that.
Tour class will have one more method, printResults. This method, which has no input parameters and no return value. This method will print the results of each team matchup, one matchup per line. For instance, if Team beat Team it will print that. Since there are teams, that makes eight matchups, so this method will print eight lines. The winner of a matchup is the team that produced the highest total score among all of the players which is the value in that team's slot in the array
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started