Question
Concepts: Scanner, methods, loops, 1 dim arrays Assignment: Write a Java program that finds the range of a list of positive values (integers) entered by
Concepts: Scanner, methods, loops, 1 dim arrays
Assignment:
Write a Java program that finds the range of a list of positive values (integers) entered by the user. The range of a list of values is defined as 1 more than the difference between the maximum and minimum values in the array, for example, if the users entered [36, 12, 25, 19, 46, 31, 22], the range will be 35 (46 12 + 1). After printing the range, print all the values. The user should be able to enter any number of values but tell the program how many numbers will be entered at the start.
Use methods to find the max, find the min and print the array.
Sample output:
How many values will be processed 5 Enter a value 31
Enter a value 56 Enter a value 12
Enter a value 9 Enter a value 34
The range of the values is 48 The values in the array are
31 56 12 9 34
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started