Computers and Technology
31.01.2021 06:17
234
377
10
Solved by an expert

Lab9A: Warmup. Write a program that contains three methods: Method max (int x, int

Lab9A: Warmup. Write a program that contains three methods: Method max (int x, int y, int z) returns the maximum value of three integer values. Method min (int X, int y, int z) returns the minimum value of three integer values. Method average (int x, int y, int z) returns the average of three integer values. Note: for Java and C#, these methods must be public and static. Prompt the user for three numbers, then call these methods from main to print out the minimum, maximum and average of numbers that the user entered. Your program should behave like the sample output below. Sample output #1 Enter number 1: 5 Enter number 2: 9 Enter number 3: 2 Min is 2 Max is 9 Average is 5.33333 Sample output 2 Enter number : 45 Enter number 2 : 11 Enter number 3: -3 Min is-3 Max is 45 Average is 17.6667
Show Answers
shyyyy13
shyyyy13
4,5(62 marks)

import java.util.Scanner;

import java.util.Arrays;

public class JavaApplication30 {

   public static int max(int x, int y, int z){

       int[] arr = {x, y, z};

       Arrays.sort(arr);

       return arr[2];

   }

   public static int min(int x, int y, int z){

       int[] arr = {x, y, z};

       Arrays.sort(arr);

       return arr[0];

   }

   public static double average(int x, int y, int z){

       return  (double) (x + y + z) / 3;

   }

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter your first number");

       int x = scan.nextInt();

       System.out.println("Enter your second number");

       int y = scan.nextInt();

       System.out.println("Enter your third number");

       int z = scan.nextInt();

       

       System.out.println("Min is "+min(x,y,z));

       System.out.println("Max is "+max(x,y,z));

       System.out.println("Average is "+average(x,y,z));

   }

   

}

I hope this helps! If you have any more questions, I'll try my best to answer them.

kiridis03
kiridis03
4,7(63 marks)

The correct answer will be "Virtual networks".

Explanation:

This networking seems to be the major element of azure connectivity that further keep track of almost all of the essential administrative responsibilities. Its function involves complete ownership over all the appointments of Ip addresses as well as the settlement of names.This decides based on the criteria for transferring the information from one place to another other.

Popular Questions about the subject: Computers and Technology

Identify the 19th-20th century art movement that embraced the...
Computers and Technology
09.09.2021 01:52
a message in the excel solver results dialog box telling you...
Computers and Technology
13.03.2022 16:51
In the context of an expert system, a works with the knowledge...
Computers and Technology
15.03.2021 15:03
Keisha is completing an internship with the local parks and recreation...
Computers and Technology
17.05.2022 18:23
33. universal containers need to add an additional recipient to...
Computers and Technology
21.07.2022 23:34
What does it mean when #div/o! is displayed and a green triangle...
Computers and Technology
25.11.2021 10:02
Should sites have to ask before they collect data on users?...
Computers and Technology
12.05.2021 01:33
How much space should be allotted to park your vehicle parallel...
Computers and Technology
14.01.2021 07:15
Abeginning driver may tend to oversteer. this means the driver...
Computers and Technology
06.06.2022 01:19
Which of the following statements is true? a.compounds keep the...
Computers and Technology
15.11.2021 02:00

New questions by subject

Which transformation change the graph of f(x)=(1/3)x into the...
Mathematics
11.12.2022 12:12
The book of Mark was written after the destruction of Jerusalem....
History
03.09.2022 22:16
Using a whole number and a fraction as factors, write a multiplication...
Mathematics
20.03.2020 06:55
What is the angle for angles 5 and 6...
Mathematics
11.11.2022 22:05
How do you do this? If you can give me the answer it’s fine :)...
Mathematics
11.12.2020 07:34
Continuation of generation is done by son though you have daughters...
Social Studies
09.02.2023 14:32
CH3CH3Li Lewis structure...
Chemistry
03.10.2021 08:48
I need help figuring out what to do with this problem, please...
Mathematics
23.04.2023 08:56
Geometry help greatly needed and appreciated !!...
Mathematics
28.09.2022 16:19
#
#
#
#
# #

We expand our knowledge with many expert answers