Question: JAVA language please!!! Do not modify the starter code . Scores are converted to integers using parseInt(). The input string will have exactly seven scores.
- JAVA language please!!!
- Do not modify the starter code . Scores are converted to integers using parseInt().
- The input string will have exactly seven scores.
- The range of valid possible scores is 00 to 99.
- A score differential refers to the difference between the two paired values that make up a score. For example, if the score is 23-20, the differential is 3.
- The number of possessions is indicated by the size of the score differential. See the table below for more information.
- A tie should be accounted as a one possession game.
- Do not print leading zeroes for single digit scores.

- Sample output:

- Starter code:
-
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Welcome!"); System.out.println("Enter sequence of scores:"); String scores = scanner.nextLine(); System.out.println("Enter number of possessions to find:"); int possessions = scanner.nextInt(); scanner.close(); // The values of each of the scores are defined below, you should use these int variables to make your patterns // Each string has 7 scores so the format of the string is oneOne // - oneTwo, twoOne - twoTwo, threeOne - threeTwo, ... int currentScoreIndex = 0; int oneOne = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int oneTwo = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int twoOne = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int twoTwo = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int threeOne = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int threeTwo = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int fourOne = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int fourTwo = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int fiveOne = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int fiveTwo = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int sixOne = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int sixTwo = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int sevenOne = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); currentScoreIndex += 3; int sevenTwo = Integer.parseInt(scores.substring(currentScoreIndex, currentScoreIndex + 2)); //DO NOT MODIFY THE STARTER CODE SHOWN ABOVE //Write Implementation Here } }
Score Differential Possessions 0-8 1 2 9-16 17-24 25-32 Welcome! Enter sequence of scores: (19-12,20-13,16-15,18-13,07-06,10-24,05-12] Enter number of possessions to find: [1] 19-12, 20-13, 16-15, 18-13, 7-6, 5-12||
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
