Write a method called printAverage that uses a sentinel loop to repeatedly prompt the user for numbers. Once the user types any number less than zero, the method should display the average of all nonnegative numbers typed. Display the average as a double. Here is a sample dialogue with the user:
Type a number: 7Type a number: 4Type a number: 16Type a number: −4Average was 9.0
If the first number that the user types is negative, do not print an average:
Type a number: −2
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.