Consider the BowlingScores program below.
/************************************************************** BowlingScores.java* Dean&Dean ** This implements a bowling scores algorithm.*************************************************************/import java.util.Scanner;public class BowlingScores{public static void main(String[] args){Scanner stdIn = new Scanner(System.in);int score;int totalScore = 0;int count = 0;double average;System.out.print("Enter score (-1 to quit): ");score = stdIn.nextInt();while (score >= 0){totalScore += score;count++;System.out.print("Enter score (-1 to quit): ");score = stdIn.nextInt();}average = (double) totalScore/count;System.out.println("Average score is " + average); }// end main}// end BowlingScores classModify this program to avoid division by zero. Initialize a boolean variable called more with true, and use it as the while loop condition. Eliminate the prompt and input before the loop and move the prompt and input inside the loop to the top of the loop. Use an “if, else” structure in the loop to set more to false and bypass the normal calculation if the input is negative.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.