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
Select the correct answer.
ioda

Answer: D

Explanation:

6 0
3 years ago
Read 2 more answers
In the 2018-2019 softball season, Allison hit the ball 28 out of 67 times, this included fouls. What was her percentage
ruslelena [56]

Answer:

Allison missed 58.21% of the times.

Explanation:

The first step is to divide 28 by 67 to get the answer in decimal form:

28 / 67 = 0.4179

Then, we multiplied the answer from the first step by one hundred to get the answer as a percentage:

0.4179 * 100 = 41.79%

Then 100(%) - 41.79(%) = 58.21%

5 0
3 years ago
What does spyware do on your computer?
Morgarella [4.7K]
It's a malware, and it basically let's the person/hacker/culprit get information off your computer without the owner of the computer knowing that the person is doing it. It's often used to find keystrokes, passwords, online interaction, and other personal data.
5 0
3 years ago
What is the best way to study for an exam?
cupoosta [38]

AnswerB

Explanation:Makes since to look over the notes each night before the exam

8 0
3 years ago
I have a singular monitor that is a TV for my computer. Recently, I took apart my computer and put it back together. When I put
makkiz [27]

your tv should have either a controls are or a setting area there is an option for "game mode" that should work with the HDMI.

4 0
3 years ago
Other questions:
  • A company is experiencing overwhelming visits to a main web server. The IT department is developing a plan to add a couple more
    5·2 answers
  • Which internet technology allows businesses to make presentations and share visual aids such as charts and graphs ?
    7·2 answers
  • According to Mintzberg's classification of managerial roles, the role of a(n) ______ is to transmit information received from ou
    7·1 answer
  • What does a cascading style sheet resolve a conflict over rules for an element?
    14·1 answer
  • There are many different types of documents that are used to convey information in the business world-letters and
    12·1 answer
  • For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player. The v
    13·1 answer
  • How many basic elements of QBASIC are there
    14·1 answer
  • Match the TCP/IP Layer to a problem that can happen there.
    8·1 answer
  • Your friend decides to create a spreadsheet containing vocabulary terms and their definitions to help prepare for the unit test
    5·1 answer
  • Which keyboard shortcut opens the find and replace dialog box to the replace tab?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!