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
Alex builds a 1 GHz processor where two important programs, A and B, take one second each to execute. Each program has a CPI of
BigorU [14]

Answer:

attached below

7 0
3 years ago
You need to design a new Access database. The first step is to organize the smallest to largest data, also called a. Alphabetica
Whitepunk [10]

Answer: d) Hierarchy of data

Explanation:

  • Hierarchy of data is defined as arrangement of data in systematic way .The arrangement of files,character,records etc is done in a particular order usually in terms of highest level and lowest level .
  • According to the question ,hierarchy of data should be used for organizing data from smallest stage to highest stage for database designing.
  • Other options are incorrect alphabetical designing is based on alphabetical order. Detail structure is a model made on basis of details and features.
  • Data design is the model or structure that includes data and related factors as building block.Logical order is the organizing elements on basis of particular logic.
  • Thus, the correct option is option(d).  
3 0
3 years ago
Difference between website and web server
Volgvan

Answer:

a web server is a computer than runs websites

7 0
3 years ago
Read 2 more answers
Which from the following list are an example of productivity software?
Scorpion4ik [409]
D. All of the Above.....
3 0
3 years ago
Read 2 more answers
One way to protect your identity while browsing is to use a(n) __________, which is another computer that screens all your incom
Eduardwww [97]
The answer is a proxy/proxy server
3 0
3 years ago
Other questions:
  • What are a few benefits of virtualization?<br> How do they benefit ?
    9·1 answer
  • What is unique about being an administrative professional in a government job?
    8·2 answers
  • Which answer best describes an unsubsidized federal loan
    9·1 answer
  • Write a program that will ask user to enter your name and count number of character ?
    6·1 answer
  • Which statement best describes the concept of usability?
    14·2 answers
  • CIST 1122 Project 2 Instructions
    11·1 answer
  • You should always assign the Needs Met rating before assigning the Page Quality rating, T or F ?
    6·2 answers
  • Which type of fiber-optic connector, containing one fiber-optic strand per connector, is connected by pushing the connector into
    7·1 answer
  • Which one my guys I need help
    7·1 answer
  • I'm getting pretty desperate plz help me, I'll give brainiest, and ill make a free question worth 100 points this is for coding
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!