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
vovikov84 [41]
3 years ago
9

Write a main program that prompts users for 5 integers. Use two separate functions to return (NOT print) the highest and lowest

value of the 5 integers. From main, display all five numbers entered and the results.
Computers and Technology
1 answer:
Soloha48 [4]3 years ago
6 0

Answer:

import java.util.Arrays;

import java.util.Scanner;

public class LatinHire {

   public static void main(String[] args) {

       Scanner in = new Scanner (System.in);

       System.out.println("Enter Five integers");

       int num1 = in.nextInt();

       int num2 = in.nextInt();

       int num3 = in.nextInt();

       int num4 = in.nextInt();

       int num5 = in.nextInt();

       int [] intArray = {num1,num2,num3,num4,num5};

       System.out.println(Arrays.toString(intArray));

       System.out.println("The Maximum is "+returnMax(intArray));

       System.out.println("The Minimum is "+returnMin(intArray));

   }

   public static int returnMax(int []array){

       int max = array[0];

       for(int i=0; i<array.length; i++){

           if(max<array[i]){

               max= array[i];

           }

       }

       return max;

   }

   public static int returnMin(int []array){

       int min = array[0];

       for(int i=0; i<array.length; i++){

           if(min>array[i]){

               min= array[i];

           }

       }

       return min;

   }

}

Explanation:

  1. This is implemented in Java Programming Language
  2. Two Methods are created returnMax(Returns the Maximum Value of the five numbers) and returnMin(Returns the minimum of the five numbers)
  3. In the Main method, the user is prompted to enter five numbers
  4. The five numbers are saved into an array of integers
  5. The returnMax and returnMin methods are called and passed the array as parameter.
  6. The entire array of numbers inputted by the user as well the Max and Min are printed

You might be interested in
Which drugs are known to distort the perception of reality and thought processes
andrey2020 [161]
<span>The correct answer here is Hallucinogen.

Technically all drugs one way or another distort the perception of reality and thought processes but hallucinogens are especially potent in that regard. Hallucinogens are those agents that can cause, among other things, hallucinations and changes in consciousness, emotions and thoughts. LSD is maybe the most known representative of the hallucinogens. </span>
7 0
3 years ago
The ___ are documents which uses http ?
givi [52]
The HTML is the answer
5 0
3 years ago
Pls I need a reply ASAP
GrogVix [38]

Answer: delete the application and install it again thats what worked for me.

Explanation:

6 0
3 years ago
Mike wants to capture some images of his application as it appears on the screen. In order to do this, Mike needs to know how to
Stells [14]
D is the best answer
I hope it’s work
5 0
2 years ago
Jason needs to design the colors for a web site that make it easy to read. Which should he consider using?
Umnica [9.8K]

Answer:

a. Contrasting background and text

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • The point at coordinates (2, -18) is in what direction from the origin?
    7·1 answer
  • Which of the following is not considered as part of technology literacy?
    8·1 answer
  • Which is true about POP3 and IMAP for incoming email?
    12·1 answer
  • On a Linux system, which command allows you to modify settings used by the built-in packet filtering firewall?
    15·1 answer
  • Applications software is also known as
    14·2 answers
  • Low-end CRM systems are designed for companies like Boeing because they only have a few, large customers.
    11·1 answer
  • You are troubleshooting a mobile device that will not pair with a Bluetooth headset. The device was functioning properly with th
    7·1 answer
  • The purpose of this assignment is to determine a set of test cases knowing only the function’s specifications, reported hereaf
    12·1 answer
  • How to write cube of a number from flowchart ​
    5·1 answer
  • How is the architecture converted into software code? Elaborate the steps its passes through with help of examples / Diagram.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!