Answer:
see explaination
Step-by-step explanation:
Part 1:
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int num1;
int num2;
int num3;
int num4;
int avg=0, pro=1;
num1 = scnr.nextInt();
num2 = scnr.nextInt();
num3 = scnr.nextInt();
num4 = scnr.nextInt();
avg = (num1+num2+num3+num4)/4;
pro = num1*num2*num3*num4;
System.out.println(pro+" "+avg);
}
}
------------------------------------------------------------------
Part 2:
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int num1;
int num2;
int num3;
int num4;
double avg=0, pro=1; //using double to store floating point numbers.
num1 = scnr.nextInt();
num2 = scnr.nextInt();
num3 = scnr.nextInt();
num4 = scnr.nextInt();
avg = (num1+num2+num3+num4)/4.0; //if avg is declared as a float, then use 4.0f
pro = num1*num2*num3*num4;
System.out.println((int)pro+" "+(int)avg); //using type conversion only integer part
System.out.printf("%.3f %.3f\\",pro,avg);// \\ is for newline
}
}