So, I have already figured out how to calculate the average and number of integers entered; however, I cannot seem to figure out how to figure out the largest, smallest, even and odd numbers. I have tried several things, but it does not work.
Any tips or suggestions? I do not need for you to write anything for me, but a little guidance would be appreciated. (this is for school, do not want to cheat, just need some help).
import java.util.Scanner;
public class Lab4
{
public static void main(String[] args)
{
double large = 0;
double small = 0;
double even = 0;
double odd = 0;
double foot = 0;
double ball = 0;
double eagles = 0;
System.out.println("Enter positive or negative integers -- enter zero to quit");
Scanner scan = new Scanner(System.in);
boolean philly = false;
while (!philly)
{
eagles = scan.nextDouble();
if (eagles == 0)
{
philly = true;
}
else
{
foot = foot + eagles;
ball++;
}
}
if (ball > 0)
{
System.out.println("The number of integers entered is: " + ball);
double avg = foot / ball;
System.out.println("Average of integers: " + avg);
}
else
{
System.out.println("No data");
}
}
}