Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

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.

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.

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"