Question: Write an application that inputs three integers from the user and displays the sum, average, product, smallest and largest of the numbers. Use the techniques

Write an application that inputs three integers from the user and displays the sum, average, product, smallest and largest of the numbers. Use the techniques shown in Fig. 2.15. The calculation of the average in this exercise should result in an integer representation of the average. So, if the sum of the values is 7, the average should be 2, not 2.3333…..

Fig. 2.15

System.out.print(

System.out.print("Enter first integer: "); // prompt int number1= input.nextInt(); // read first number from user System.out.print("Enter second integer : "); // prompt int number2 = input.nextInt(); // read second number from user if (number1== number2) System.out.printf("%d ==%d%n", number1, number2); } if (number1 != number2) { System.out.printf ("%d != %d %n", number1, number2); } if (number1 < number2) { System.out.printf(("%d < %d%n", number1, number2); } if (numberl> number2) { } if (number1 = number2) { System.out.printf("%d >= %d %n", numberl, number2); System.out.printf("%d > %d %n", numberl, number2); } } // end method main. } // end class Comparison Enter first integer: 777 Enter second integer: 777 777 == 777 777 = 777 Enter first integer: 1000 Enter second integer: 2000 1000 2000 1000 2000 1000 < 2000 Enter first integer: 2000 Enter second integer: 1000 2000 1000 2000 1000 2000 1000

Step by Step Solution

3.50 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question asks for an application that takes three integer inputs from the user and then displays ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java How To Program Late Objects Questions!