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
What are the pros and cons of MP3 audio archives?
UkoKoshka [18]
Was this in reference to literal audio archives? If so, I don't see any cons beside possible copyright infringement.

If you're talking about the codecs themselves, then I can do that.

<span>Pros:

</span>- Widespread acceptance. Supported in nearly all hardware devices, and continually adopted by newer ones.

- Faster decoding. Much more so than FLAC, Vorbis, etc.

- Relaxed licensing schedule.

<span>Cons:
</span><span>
</span>- Lower quality and efficiency than most modern codecs. (To be fair, never really noticed this one).

- Sometimes the maximum bitrate isn't enough.

- Pretty much void/unusable for high definition audio (higher than <span>48kHz).</span>

 
7 0
4 years ago
Using the Caesar cipher, "HELLO" is encrypted to "OLSSV" by applying a shift of 7. The number 7 is considered the __________
Semenov [28]

Answer:

The offset

Explanation:

In the question, we understand that the original text is HELLO and the encrypted text is OLSSV.

It should be noted that O replaced H, L replaced E, S replaced L and V replacement O.

This is made possible by a term refered to as offset.

The offset is used to determine the character that will replace another when it is encrypted.

7 characters after H is O; this is same for every other characters in the text.

8 0
3 years ago
_____ is a higher-level, object-oriented application interface used to access remote database servers
makkiz [27]
RDO.

RDO uses the lower-level DAO and ODBC for direct access to databases.
7 0
1 year ago
Which of the following ensures that dropped packets are resent?
Agata [3.3K]

Answer:

TCP

Explanation:

Transmission control protocol ensures packets loss and performs retransmission

TCP works with Internet Protocol (IP)

TCP/IP defines how computers send data packets to each other.

TCP allows transmission of information in both the direction.

Bit rate :defines the rate at which bits are transferred from one place to another

7 0
3 years ago
you type out a few sentences in an ms word file, and save it on your desktop. how is this data stored in the computer?
rosijanka [135]

When one is  typing on MS word and one save the file, this data would be stored as combination of 1s and 0s in the computer.

  • Computer data storage can be regarded complex system, immediately a data is saved then;

  • The first be converted to simple numbers of 1s and 0s , this number are very easy for a computer to store and these number are regarded as Binary Numbers and all letters as well as photographs are converted to numbers,

  • The hardware will record this saved numbers inside the computer.

  • These numbers are then  organized and transferred to temporary storage which be manipulated by programs, or software.

Therefore, data are been stored as 1s and 0s in the computer.

Learn more at:brainly.com/question/21571591?referrer=searchResults

8 0
3 years ago
Other questions:
  • Florida convicted __________ people of DUI in a one-year period from 2009 to 2010.
    15·1 answer
  • It is essential that a security professional is able to resolve and respond to cyber law inquiries and incidents while avoiding
    14·1 answer
  • Marcus just created a new folder specifically for his buisness records so he would like to move last months business transaction
    13·2 answers
  • Which of the following is a beneficial reason to extract mineral resources from the earth?
    13·2 answers
  • Within the try clause of a try statement, you code a. all the statements of the program b. a block of statements that might caus
    14·1 answer
  • What is the name of the technology that is typically implemented on switches to avoid Ethernet connectivity problems when the wr
    11·1 answer
  • Urgent ..algorithm and flowchart to check weather a number is odd or even ???​
    8·2 answers
  • Can I ask a computer question based on engineering?
    8·1 answer
  • Derek has to create a technical design of a complex floor plan using CAD. What will be most helpful for Derek to use to create t
    8·1 answer
  • Can you help me solve this challenging activity?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!