code
Consider this code snippet that uses a “while” loop. The intent of the program is to ask the user to enter 10
numbers and only 10 numbers. What is wrong with the code and how would you fix it? How would you test your fix to verify that you fixed the problem(s)?
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int numbersEntered = 0;
int number;
while (numbersEntered < 10) {
System.out.println(“Please enter a number”);
number = input.nextInt();
System.out.print(“You have entered a total of ” + numbersEntered + “n”);
}
}
Could you rewrite this using another loop structure and if so how? Your initial post should be a maximum of two paragraphs and should explain any errors with the code and how would fix them. Your initial post should describe how you would test your fix to verify that you fixed the problem(s). Respond to at least two other posts. Your response post should assess your classmates’ determination on what is wrong with the original code, their alternative solution using another loop structure, and their test ideas.