Reaksomayroth
25.02.2020 •
Computers and Technology
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.
Solved
Show answers
More tips
- H Health and Medicine How to Whiten Teeth and Get the Perfect Smile...
- S Style and Beauty How to Properly Apply Eye Makeup: Tips from a Professional Makeup Artist...
- A Auto and Moto How Can Parking Sensors Help Drivers?...
- C Computers and Internet Make Money Online: Secrets and Essential Ways...
- A Auto and Moto What is the Average Lifespan of an Engine in a Car?...
- H Health and Medicine What You Need to Know About Nasal Congestion in Infants: Causes, Symptoms, and Treatment...
- S Science and Technology Discovering the Anatomy of an LCD TV Screen...
- F Food and Cooking How to Get Reconfirmation of Registration?...
- F Food and Cooking Why Doesn t the Confirmation Link Come to Email?...
- F Food and Cooking Deflope: What is it and how does it work?...
Answers on questions: Computers and Technology
- C Computers and Technology Direct messages are the only private forms of communication on twitter. true false...
- M Mathematics PLEASE HELP A.S.A.P. A recipe calls for 1 ¾ cups of brown sugar. If I am only making ¾ of the recipe, how much brown sugar should I use?...
- A Arts Tell me somethin to draw and i will...
- H History Who refused to free the hebrewa from egypt? nebuchadnezzarcyrus the great yahweh Ramses the great...
- E English What is (98)35(76)+83 You know I want you It s not a secret I try to hide I know you want me So don t keep sayin our hands are tied You claim it s not in the cards And...
- M Mathematics Mariel and Sams savings account had a balance of $9,544 on May 1. The account earns interest at a rate of 5.25% compounded monthly until the end of August....
- M Mathematics 2. John has $2500 in his savings account. He adds $400 to it in January. Calculate the percemt change in the value of his savings account in January....
- E English Extra! Extra! Backyard Birding Many schools, families, and young birders across the country participate in the Great Backyard Bird Count. While not as long as a Big Year,...
- M Mathematics Linda already owns 7 necklaces, and additional necklaces are priced at 3 for a dollar. Write an equation that shows the relationship between the money spent on additional...
- H History After reading the excerpts from the two textbooks, which one do you think is MORE TRUSTWORTHY? Explain your answer and cite examples from the text to support your 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:
This is implemented in Java Programming LanguageTwo Methods are created returnMax(Returns the Maximum Value of the five numbers) and returnMin(Returns the minimum of the five numbers)In the Main method, the user is prompted to enter five numbersThe five numbers are saved into an array of integersThe returnMax and returnMin methods are called and passed the array as parameter.The entire array of numbers inputted by the user as well the Max and Min are printedОтвет:
hey
Explanation: