Answer:
i hope the program below will help you!
Explanation:
Opinion wise, I disagree with punishment.
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 Language
- Two 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 numbers
- The five numbers are saved into an array of integers
- The 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
Answer:
0
Explanation:
Given the code segment:
- int product = 1;
- int max = 20;
- for (int i = 0; i <= max; i++)
- product = product * i;
-
- System.out.println("The product is " + product);
Since the counter i in the for loop started with 0, and therefore <em>product * i </em>will always be 0 no matter how many rounds of loop to go through.
The code is likely to perform factorial calculation. To do so, we need to change the starting value for the counter i to 1.
- int product = 1;
- int max = 20;
- for (int i = 1; i <= max; i++)
- product = product * i;
-
- System.out.println("The product is " + product);
Answer:
The delay to send each packet will be ttrans + tprop. However there is an additional tprop delay for the acknowledgement packet to arrive at the sender, prior to which the next packet can be transmitted. Hence the total delay to transmit 10 packet is = 10 * (ttrans + 2 tprop) = 10*(40 msec + 80 msec) = 1.2 sec
Explanation: