Java Arrays program with full source code | Download Now

Program Description

Write a program that reads positive numbers (integers) and stores them into an array.
  1. Write a method to prompt for the input values. (sentinel terminated)
  2. Write a method to print the array.
  3. Write a method that returns the value of the smallest number.
  4. Write a method that returns the value of the largest number.
  5. Write a method to find the location of a number (array index + 1)
  6. Write a method to compute the average of the numbers in the array.
  7. Write a method to output the results.

The input prompt example:

Enter at least 10 unique positive numbers (integers) terminated with a sentinel value (-1)

Expected Output

Amount of numbers read: 10
Numbers read: 12, 33, 41, 1, 4, 10, 7, 21, 66, 50
Smallest number was 1 in location 4
Largest number was 66 in location 9
Average was 24.5

Output Screenshot


Get Project Solution Now

Comments