Answer:
The program in Java is as follows:
import java.util.*;
public class Main{
public static void main(String[] args) {
int userNum;
Scanner input = new Scanner(System.in);
System.out.print("Enter integer: ");
userNum = input.nextInt();
System.out.println("You entered "+userNum);
System.out.println(userNum+" squared is "+(userNum*userNum));
System.out.println(userNum+" cubed is "+(userNum*userNum*userNum));
int userNum2;
System.out.print("Enter another integer: ");
userNum2 = input.nextInt();
int sum= userNum + userNum2; int product = userNum2 * userNum;
System.out.println(userNum+" + "+userNum2+" = "+sum);
System.out.println(userNum+" * "+userNum2+" = "+product); } }
Step-by-step explanation:
This declares userNum
int userNum;
Scanner input = new Scanner(System.in);
This prompts the user for input
System.out.print("Enter integer: ");
This gets user input from the user
userNum = input.nextInt();
Number (1) is implemented here
System.out.println("You entered "+userNum);
Number (2) is implemented here
System.out.println(userNum+" squared is "+(userNum*userNum));
System.out.println(userNum+" cubed is "+(userNum*userNum*userNum));
This declares another variable userNum2
int userNum2;
This prompts the user for another input
System.out.print("Enter another integer: ");
This gets user input from the user
userNum2 = input.nextInt();
This calculates the sum and the product
int sum= userNum + userNum2; int product = userNum2 * userNum;
Number (3) is implemented here
System.out.println(userNum+" + "+userNum2+" = "+sum);
System.out.println(userNum+" * "+userNum2+" = "+product);