Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

When I try to change the value that enables the user to exit, it does not compile the changes. I am unsure why. I am trying to change the value to

When I try to change the value that enables the user to exit, it does not compile the changes. I am unsure why. I am trying to change the value to exit from -1 to -5. Any ideas? Also, do you see any major errors with the code?---------------------------------------Instructions:write a program that will accept as input between 2 and 25 numbers and then calculate the average of the numbers.* Make sure you use floating-point numbers in case the average is not a whole number.* You should create the program to work in a loop to accept the input until you instruct the program that no more input is forthcoming and to then calculate the average.* Your output should include the numbers used as input and then the average of the input numbers.--------------------------------------------------import java.util.*;public class average{public static void main(String args[]){float[] number = new float[25];double average=0,sum=0;int i=0,j,count=0;Scanner input= new Scanner(System.in); System.out.print("Enter number (-1 to exit) " + (i+1) +":");number[i]=input.nextDouble();do //do while loop enables user to keep entering numbers{sum+=number[i];i++;System.out.print("Enter number (-1 to exit) " + (i+1)+ ":");number[i]=input.nextDouble();}while(number[i]!=-1&&i<24);average=sum/i;System.out.println("Your numbers are:");for(j=0;j<i;j++) System.out.print(number[j]+" ");System.out.println("nThe average is " + average);}}

write a program that will accept as input between 2 and 25 numbers and then calculate theaverage of the numbers. * Make sure you use floating-point numbers in case the average is not a whole...
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question