When a programmer uses the break statement in their code suc
When a programmer uses the break statement in their code, such code (in which the break statement is used) violates the principles of structured programming. Re-write the program fragment, which is shown below, in a way that avoids or excludes your use of the break statement, without causing the program code fragment to work differently than when the break statement is used (in other words, even after you avoid/exclude using the break statement, the program code should still work exactly as when the break statement is used). for(int i = 0; i
Solution
Here is the code equivalent for you code, but without using a break statement.
int i = 0;
while(i < 5 && jersey != jersey[i]) //For each value of i, if jersey value is not equal to jersey[i].
i++; //Just move forward.
if(i < 5) //If i value is within the range, that means, jersey == jersey[i] happened, and should process the block.
{
System.out.print(\"Enter a new jersey number: \");
jersey = kbdInput.nextInt();
System.out.print(\"Enter a rating for the new player: \");
rating = kbdInput.nextInt();
jerseyNum[i] = jersey;
playerRating[i] = rating;
}
