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


Download solution now

Buy now

CONTACT DETAILS

For any other questions or other tasks please feel free to contact me
via email: mhassnainjamil@gmail.com
via WhatsApp: +92-324-7042178
via skype: hassnainjamil1

Comments

Popular posts from this blog

[SOLVED] Tape for a Turing Machine using Doubly-linked List in Java with full source code

[SOLVED] ICT285 Databases TMA 2017 Assignment 1 | Relational Algebra, Database Design & Implementation