Oops! Thanks for finding the bug in the average. I guess I should've tested with more numbers other than 1, 2, and 3 since both the sum and product would be the same. I posted the corrections below...
As the other code, I've noticed several ways to make it work (like with counters and arrays); however, the workbook that I'm getting the exercise from stated to only use what was learned from the chapter...and I tried with using the &&s again, like..
if ( int1 > int2 && int1 > int3 && int1 > int4 && int1 > int5 ) big = int1;
but that didn't work...fortunately, I did find the answer after more searching...and I'm gonna post it in a new thread as you suggested...although, I would like to see how you can do the same thing with the ands...thanks again!
import java.util.Scanner; // program uses class scanner
public class ThreeIntegerSumAvgProductSmallLarge
{
public static void main ( String args [] )
{
Scanner consoleScanner = new Scanner ( System.in );
int number1,
number2,
number3,
sum,
average,
product,
smallest = 0,
largest = 0;
System.out.print ( "Please enter 1st integer: " );
number1 = consoleScanner.nextInt ();
System.out.print ( "\nPlease enter 2nd integer: \n" );
number2 = consoleScanner.nextInt ();
System.out.print ( "Please enter 3rd integer: \n" );
number3 = consoleScanner.nextInt ();
sum = number1 + number2 + number3;
average = ( ( number1 + number2 + number3 ) / 3 );
product = number1 * number2 * number3;
if ( number1 > number2 && number2 > number3 )
largest = number1;
if ( number2 > number1 && number1 > number3 )
largest = number2;
if ( number3 > number2 && number2 > number1 )
largest = number3;
if ( number1 < number2 && number2 < number3 )
smallest = number1;
if ( number2 < number1 && number1 < number3 )
smallest = number2;
if ( number3 < number2 && number2 < number1 )
smallest = number3;
System.out.printf ( "%s%d\n", "The sum of your three numbers is: ", sum );
System.out.printf ( "%s%d\n", "The product of your three numbers is: ", product );
System.out.printf ( "%s%d\n", "Your three numbers produced an average of: ", average );
System.out.printf ( "\n%s%d\n", "The largest number out of the three is: ", largest );
System.out.printf ( "%s%d\n", "The smallest number out of the three is: ", smallest );
} // end method main
}