Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
int n1 = input.nextInt();
System.out.print("Enter a number: ");
int n2 = input.nextInt();
System.out.print("Enter a number: ");
int n3 = input.nextInt();
System.out.println("The sum is: " + calculateSum(n1, n2, n3));
System.out.println("The product is: " + calculateProduct(n1, n2, n3));
System.out.println("The average is: " + calculateAverage(n1, n2, n3));
}
public static int calculateSum(int n1, int n2, int n3){
return n1 + n2 + n3;
}
public static int calculateProduct(int n1, int n2, int n3){
return n1 * n2 * n3;
}
public static double calculateAverage(int n1, int n2, int n3){
return (n1 + n2 + n3) / 3.0;
}
}
Step-by-step explanation:
In the main:
Ask the user to enter the numbers using Scanner
Call the functions with these three numbers and display results
In the calculateSum function, calculate and return the sum of the numbers
In the calculateProduct function, calculate and return the product of the numbers
In the calculateAverage function, calculate and return the average of the numbers