Must be in JAVA Write an application that solicits and input

Must be 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.

Solution

import java.io.*;
import java.util.*;

class Solution {

  
public static void main(String arg[])
{
Scanner sc=new Scanner(System.in);/// take input from user
  
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
  
int sum,product,avg,max,min;
sum=a+b+c;
product=a*b*c;
avg=sum/3;
if(a>b)
{
if(a>c)
{
max=a;
}
else max=c;
}
else if(b>c)
max=b;
else max=c;
  
if(a<b)
{
if(a<c)
{
min=a;
}
else min=c;
}
else if(b<c)
min=b;
else min=c;
  
System.out.println(\"sum \"+sum+\" product \"+product+\" avg \"+avg+\" small \"+min+\" largest \"+max);
}
  
}

Must be in JAVA: Write an application that solicits and inputs three integers from the user and then displays the sum, average, product, smallest, and largest o

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site