# Notepad can not find the symbol for average, max, min, etc.

First, this is a homework assignment. I am supposed to create a program using a switch command. It asks the user to input 3 integers, then input an integer of 1-5 for the five cases average, max, min, total, and exit. I have pretty much completed this program, first having a user input 3 integers, then creating the switch "menu" structure, and inside each case, I attempted to create the mathematics for each of the arithmetic functions.

My error message is "cannot find symbol", which is a broad and vague error message to post about. Everything I have Googled, or found on this site seems to be unrelated to the specific symbols that my program is missing, and/or can be typographical in nature. So, unfortunately, I've had to create another thread about this.

My program can not find the symbols average, max, min, and et cetera. I believe that I may have done my arithmetic algorithms wrong, and they are either not initialized properly or at all, or I need to set them to zero before the switch command is ever used.

I'll need to post the code so you can see what I have done:

``````>public static void main( String args[] )
{
// Attempting to initialize the 3 integers AND the user-input early on
int n1, n2, n3, n4;

Scanner sc = new Scanner( System.in);

while ( true )
{
System.out.println ( "Please give three integers separated by spaces: " );
n1 = sc.nextInt();
n2 = sc.nextInt();
n3 = sc.nextInt();

// building a menu - hoping integers aboive will work in Switch command
System.out.println( "\n****** Analysis Menu ******" );
System.out.println( "1: Average" );
System.out.println( "2: Maximum" );
System.out.println( "3: Minimum" );
System.out.println( "4: Total" );
System.out.println( "5: Exit" );
System.out.println( "*******************\n" );

n4 = sc.nextInt(); // get the user selection

if ( n4 == 1 )
{
Average = n1 + n2 + n3 / 3;
System.out.print( "Average = " + Average );
}
else if ( n4 == 2 )
{
max = n1;
if ( max < n2 ) max = n2;
if ( max < n3 ) max = n3;

System.out.println( "Maximum = " + max );
}
else if ( n4 == 3 )
{
min = n1;
if ( min > n2) min = n3;
if ( min > n3) min = n2;
System.out.print( "Minimum = " + min );
}
else if ( n4 == 4 )
{
total = sum;
System.out.print( "total = " + total );
}
else if ( n4 == 5 )
{
System.out.println( "You have selected Exit." );
break;
}
else
{
System.out.println( "No such selection exists." );
```
```

The error messages say they cannot find every total, min, max, average, and sum in this. So I am not sure if I need to initialize them somehow, set them to 0, or even how to do that in this context.

There are multiple issues in above code: 1. Average, min, max variable not defined. 2. You average logic is not right. 3. You are missing end brace.

I tried to modify these and this is what i came up with.

``````public static void main( String args[] )
{
// Attempting to initialize the 3 integers AND the user-input early on
int n1, n2, n3, n4;
int Average, max, min, total;
Scanner sc = new Scanner( System.in);

while ( true )
{
System.out.println ( "Please give three integers separated by spaces: " );
n1 = sc.nextInt();
n2 = sc.nextInt();
n3 = sc.nextInt();

// building a menu - hoping integers aboive will work in Switch command
System.out.println( "\n****** Analysis Menu ******" );
System.out.println( "1: Average" );
System.out.println( "2: Maximum" );
System.out.println( "3: Minimum" );
System.out.println( "4: Total" );
System.out.println( "5: Exit" );
System.out.println( "*******************\n" );

n4 = sc.nextInt(); // get the user selection

if ( n4 == 1 )
{
Average = (n1 + n2 + n3) / 3;
System.out.print( "Average = " + Average );
}
else if ( n4 == 2 )
{
max = n1;
if ( max < n2 ) max = n2;
if ( max < n3 ) max = n3;

System.out.println( "Maximum = " + max );
}
else if ( n4 == 3 )
{
min = n1;
if ( min > n2) min = n3;
if ( min > n3) min = n2;
System.out.print( "Minimum = " + min );
}
else if ( n4 == 4 )
{
total = n1 + n2 + n3;
System.out.print( "total = " + total );
}
else if ( n4 == 5 )
{
System.out.println( "You have selected Exit." );
break;
}
else
{
System.out.println( "No such selection exists." );
}
}
}
```
```