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
Given main() and a base Book class, define a derived class called Encyclopedia. Within the derived Encyclopedia class, define a
alexandr1967 [171]

Answer:

..

Explanation:

i dont really know. I am just answering for the sake of points lol

8 0
3 years ago
Mathematics and computer science share many concepts, such as recursion.
Virty [35]
The answer is B.

Read the answer I posted for your other question on the factorial of 7.
5 0
2 years ago
What must your motherboard have to use bitlocker encryption in windows 7 which will ensure that your hard drive cannot be used i
Gala2k [10]

your motherboard must have TPM Chip to use bitlocker encryption in windows 7 which will ensure that your hard drive cannot be used in another computer.

<h3 /><h3>What is a motherboard?</h3>
  • The primary printed circuit board (PCB) of all-purpose computers and other extensible systems is called a motherboard.
  • The primary printed circuit board (PCB) of a computer is called the motherboard. All components and external peripherals connect to a computer's motherboard, which serves as its main communications hub.
  • It offers connections for various peripherals and retains and enables communication between many of the critical electrical parts of a system, including the memory and central processor unit (CPU).
  • In contrast to a backplane, a motherboard frequently houses important sub-systems such the central CPU, input/output and memory controllers for the chipset, interface connections, and other parts that are integrated for general usage.
  • Specifically, a PCB with expansion capability is referred to as a motherboard.

To learn more about motherboard, refer to the following link:

brainly.com/question/15058737

#SPJ4

6 0
2 years ago
Who was making the high-pitched growling noise that Francisco hears?
Gwar [14]

The high-pitched growling noise that Francisco hears is due to mating call of male midshipman fish or 5G.

<h3>What is the  hum about?</h3>

The Hum is known to be a kind of unexplained happenings that has brought a lot of irritations to people. It is known to be a high-pitched noise that brought a lot of scientific theories.

Studies has shown that the high-pitched growling noise that Francisco hears is as a result of  mating call of male midshipman fish or 5G.

Learn more about noise from

brainly.com/question/2278957

8 0
2 years ago
Bill Schultz works at a high power investment firm in Los Angeles. Bill is responsible for promoting the firm's vision and creat
Anna35 [415]

Answer:a

Explanation:

4 0
3 years ago
Other questions:
  • How i can connect to internet automatically when i switch on my computer?
    8·1 answer
  • How to access files on different computer same network
    14·1 answer
  • What is often called a platform, a collection of computer programs that work together to manage hardware and software to ensure
    12·1 answer
  • The main devices in a rectifier are:
    14·2 answers
  • Which of the following is NOT a component of a DFD?
    8·1 answer
  • What's the answer to the image? True or False
    15·1 answer
  • If you want to change the smart quote settings, what steps should you follow to find them?
    5·1 answer
  • Describe how communication strengthens relationship at work and, as a result, increases your productivity
    9·1 answer
  • 4.15 LAB: Password modifier
    14·1 answer
  • Write the name of main ore of silver.Write any two application of sliver​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!