This code must be written in JAVA Write an application that solicits and inputs
ID: 638111 • Letter: T
Question
This code must be written in JAVA
Write an application that solicits and inputs three integers from the user and then displays the sum, average, product, smallest, and largest of the three numbers. You may use any Java input and output method you want, for example the JOptionPane class or the Scanner class.
You must use only integer arithmetic for your calculations.
Use the numbers 7, 3, and 5, in that order, for your program execution that you will submit. Although your program must be written to handle any three integers in general, these specific values must be used for this program submission, in this order.
You may use the Windows Command Prompt command line interface or any Java IDE you choose to compile and execute your program.
Explanation / Answer
import java.util.Scanner; public class ArithmeticSmallestLargest { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num1; int num2; int num3; int sum; int average; int product; int largest; int smallest; System.out.print("Enter First Integer: "); num1 = input.nextInt(); System.out.print("Enter Second Integer: "); num2 = input.nextInt(); System.out.print("Enter Third Integer: "); num3 = input.nextInt(); sum = num1 + num2 + num3; average = sum / 3; product = num1 * num2 * num3; largest = num1; smallest = num1; if(num2 > largest) largest = num2; if(num3 > largest) largest = num3; if(num2Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.