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
Consider the following recursive method: public int someFun(int n) { if (n &lt;= 0) return 2; else return someFun(n-1) * someFun
Stella [2.4K]

Answer:

(a) someFunc(3) will be called 4 times.

(b) For non negative number n someFunc method calculates 2^2^n.

Explanation:

When you call someFunc(5) it will call someFunc(4) two time.

So now we have two someFunc(4) now each someFunc(4) will call someFunc(3) two times.Hence the call to someFun(3) is 4 times.

someFunc(n) calculates someFunc(n-1) two times and calculates it's product.

someFunc(n) = someFunc(n-1)^2..........(1)

someFunc(n-1)=someFunc(n-2)^2..........(2)

substituting the value form eq2 to eq 1.

someFunc(n)=someFunc(n-2)^2^2

       .

       .

       .

       .

= someFunc(n-n)^2^n.

=2^2^n

2 raised to the power 2 raised to the power n.

3 0
3 years ago
Find the place with the greatest number of agency offices of the company.
zavuch27 [327]

Answer:

hope fully this is help full

5 0
3 years ago
You have just deployed SNMPv3 in your environment. Your manager asks you to make sure that your SNMP agents can only talk to the
zavuch27 [327]

Answer:

Configure A SNMP Group containing the SNMP managers.

Explanation:

Configure A SNMP Group containing the SNMP managers.

3 0
3 years ago
Some systems provide a small amount of dedicated memory built into the CPU that maintains a record of previous choices for each
rewona [7]

Answer:

b) branch history table

Explanation:

Branch prediction in computer architecture which works by predicting or guessing  which way an operation (conditional operation: like an if-else-operation)  will go before it occurs. This operation is performed by a digital circuit known as branch predictor. Branch history table contains the address of the branch instruction. In branch history table, when there is a branch instruction, a bit is store to indicate if the branch was recently taken.

3 0
4 years ago
Read 2 more answers
A computer designed for the sole purpose of playing games (and often sold without a keyboard) is known as a:________.
Tamiku [17]
The answer is a console
8 0
3 years ago
Other questions:
  • Reasons for the growth of decision-making systems include:
    13·1 answer
  • What is the advantage of using the clipboard task pane?
    7·1 answer
  • To share a document in my online electronic journal, I should select the option to _____.
    14·1 answer
  • In which architecture is the application logic usually on the client side?
    8·1 answer
  • The point of entry from a wireless device to a wired network is performed at a device called a(n) ____________________.
    10·1 answer
  • A command, such as a button or keyboard shortcut, that performs a specific task is known as a
    9·2 answers
  • You are troubleshooting a client connectivity problem on an Ethernet network. The client system has intermittent connectivity to
    9·1 answer
  • Question 10
    14·1 answer
  • CH4 has how many of each type of atom?
    11·1 answer
  • A good machine should have the mechanical advantage of......?​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!