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
Who all likes fortnite
Debora [2.8K]

Answer:

my brother

Explanation:

5 0
3 years ago
Read 2 more answers
a sign is to be hung from the end of a thin pole, and the pole supported by a single cable. your design firm brainstorms the six
Angelina_Jolie [31]
The correct answer for the question that is being presented above is this one: "C=F>D>A>B>E" <span>A sign is to be hung from the end of a thin pole, and the pole supported by a single cable. Based from the 6 images, the sequence of inequalities should be C = F > D > A > B > E</span>
4 0
3 years ago
Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
erastova [34]

Answer:

Mercury, rontgen rays, etc.

Explanation:

There are lots of answers to this question, hope these two help.

6 0
2 years ago
he Saffir-Simpson Hurricane Scale classifies hurricanes into five categories numbered 1 through 5. Write an application named Hu
AnnyKZ [126]

Answer:

The program plan requires the design of the gui program form

Explanation:

The program plan will be as follows:

take 4 label and 4 text box and 1 button and modify the property of controls to design the gui form.

use 6 if statements and 1 else statement.

use or operator for comparison.

show message in textbox.

program code:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System. Data;

using System.Drawing;

using System.LINQ;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace...

4 0
2 years ago
Read 2 more answers
A ___________ organizes related commands together, under a tab.
notsponge [240]
A menu bar organizes related commands together, under a tab.
So the answer is <span>b. menu bar</span>
8 0
3 years ago
Other questions:
  • Which type of security personnel may work for government as well as for private security agencies?
    7·2 answers
  • Text can be easily moved from one location to another using _____.
    15·1 answer
  • If the computer has an encrypted drive, a ____ acquisition is done if the password or passphrase is available. a. passive b. sta
    8·1 answer
  • What form of communication are they using​
    6·1 answer
  • How is the architecture converted into software code? Elaborate the steps its passes through with help of examples / Diagram.
    15·1 answer
  • Explain why you do not need expensive equipment to take pictures or record video?
    7·2 answers
  • __________ implements a security policy that specifies who or what may have access to each specific system resource and the type
    8·1 answer
  • Which of the following statements describe the benefits of a career in transportation, distribution, and logistics (TDL)?
    5·1 answer
  • Suppose in an Excel spreadsheet, the value in cell A1 is 25. By using the Macabacus local currency cycle shortcuts (Ctrl + Shift
    10·1 answer
  • To optimize the flow of data into and out of the cpu, the modern mcc provides at least _______________ of data every time the cp
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!