Question
Write a Java program that prompts the user to enter three integers from the keyboard, one at a time. The program then outputs the larger
Write a Java program that prompts the user to enter three integers from the keyboard, one at a time. The program then outputs the larger of the first and second integers entered, unless the third integer entered is even, in which case the program outputs the smaller of the first two integers. However, if the first two integers entered are the same, the program outputs the product of the three integers, regardless of whether the third integer is even or odd. Here are several sample runs:
Enter an integer: 13
Enter an integer: 42
Enter an integer: 101
Output: 42
-------------------------------------------------------
Enter an integer: 13
Enter an integer: 7
Enter an integer: 5
Output: 13
-------------------------------------------------------
Enter an integer: 50
Enter an integer: 70
Enter an integer: 6
Output: 50
-------------------------------------------------------
Enter an integer: 1000
Enter an integer: 600
Enter an integer: 88
Output: 600
-------------------------------------------------------
Enter an integer: 10
Enter an integer: 10
Enter an integer: 9
Output: 900
-------------------------------------------------------
Enter an integer: 5
Enter an integer: 5
Enter an integer: 10
Output: 250
-------------------------------------------------------
public static void main(String [] args) {
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started