1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KonstantinChe [14]
3 years ago
10

Write a Java program that has a static method named range that takes an array of integers as a parameter and returns the range o

f values contained in the array. The range of an array is defined to be one more than the difference between its largest and smallest element. For example, if the largest element in the array is 15 and the smallest is 4, the range is 12. If the largest and smallest values are the same, the range is 1.
Computers and Technology
1 answer:
SashulF [63]3 years ago
5 0

Answer:

The program in Java is as follows:

import java.util.*;

import java.lang.Math;

public class Main{

public static int range(int low, int high){

    return Math.abs(high - low)+1;

}

public static void main(String[] args) {

 Scanner scnr = new Scanner(System.in);

 int num1 , num2;

 System.out.print("Enter two numbers: ");

 num1 = scnr.nextInt();

 num2 = scnr.nextInt();

 System.out.print(range(num1,num2));

}

}

Explanation:

This defines the range method

public static int range(int low, int high){

This calculates and returns the range of the two numbers

    return Math.abs(high - low)+1;

}

The main begins here

public static void main(String[] args) {

 Scanner scnr = new Scanner(System.in);

This declares 2 numbers as integer

 int num1 , num2;

This prompt the user for two numbers

 System.out.print("Enter two numbers: ");

The next two lines get input for the two numbers

 num1 = scnr.nextInt();

 num2 = scnr.nextInt();

This calls the range function and prints the returned value

 System.out.print(range(num1,num2));

}

You might be interested in
Relatively simple CRUD (create, read, update, delete) web applications development can be facilitated with: _________.
Talja [164]

Answer:

c. Web Application Frameworks

Explanation:

Web Application Frameworks is a form of a software framework that is made to perform support for the building of web applications such as web services, web resources, and web APIs. Web frameworks.

Also, Web Application Frameworks automatically perform the function of primary activities carried out in web development such as create, read, update, delete.

Hence, in this case, the correct answer is Web Application Framework.

5 0
3 years ago
If A = 5 i + j abd B = 2k then A - B in equal to​
Leto [7]

the answer is A-B=5i+j-2k

8 0
3 years ago
Reggie has hired you to design a home network. The home network will share a printer but will mainly be used to stream movies to
SIZIF [17.4K]

Answer:

i think the answer is a

Explanation:

3 0
3 years ago
Hi I need help, This assignment is for Assignment 6 Question 3 in edhesive for computer science. here is the prompt:
miv72 [106K]

Answer: print("THIRD")

for i in range(10):

   for j in range(10-i):

       print(" ", end=" ")

   for j in range(i):

       print("*", end=" ")

   print("")

Explanation:

You're Welcome yall

print("THIRD")

for i in range(10):

   for j in range(10-i):

       print(" ", end=" ")

   for j in range(i):

       print("*", end=" ")

   print("")

6 0
4 years ago
In which part is data processing done?
postnew [5]
Data processing is done in cpu of computer
4 0
4 years ago
Other questions:
  • Page _____ refers to whether a page is laid out vertically or horizontally.
    12·1 answer
  • Describe data center technology and its relevance to modern-day cloud computing. Support your opinion with cited information.( S
    14·1 answer
  • What is the difference between a technological problem and a technological opportunity? Explain with an example.
    7·2 answers
  • Imagine you had a learning problem with an instance space of points on the plane and a target function that you knew took the fo
    11·1 answer
  • Network in which every computer is capable of playing the role of the client, server or both at the same time is called *
    6·1 answer
  • HELLLPPPPPP For each of the following discussion questions, write a response in complete sentences. Your response should be at l
    6·1 answer
  • Write a C++ program that creates a map containing course numbers and the room numbers of the rooms where the courses meet. The d
    12·1 answer
  • Code is the code or instructions used to create a Web page or<br> program.
    15·1 answer
  • In what year was the earliest documented use of the word computer?.
    9·1 answer
  • Range paramters - for loop<br> question in picture
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!