I made a program where the user types the name of a student and their 3 grades of the partial ones.
The grade can not be greater than 10 and if it is then it asks you to enter another grade again.
However when I enter numbers greater than 10 this one anyway stores it instead of asking me to change the number.
Another error is that when I enter the option of Consultation of averages this returns me to the main menu instead of giving me the averages.
import java.io.*;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import javax.swing.*;
public class ExamenCalificaciones{
public static void main (String[]args) throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
String []nombre= new String [100];
int op_menu;
int []calificacion_1= new int[100];
int []calificacion_2= new int[100];
int []calificacion_3= new int[100];
int []promedio= new int[100];
int totales=1;
int x=0;
int y=0;
int i=0;
int ejecutar=0;
int aux;
int exitmenu=0;
String auxnombre;
int passed=0;
int flunked=0;
do{
System.out.println("Menu de Captura de Calificaciones");
System.out.println("Ingrese la opcion deseada \n 1.Captura \n 2.Consulta de promedios \n 3.Salir");
op_menu=Integer.parseInt(br.readLine());
if(op_menu==1)
{
System.out.println("Capturas");
System.out.println("Ingresa el nombre del alumno:");
x=x+1;
nombre[x]=br.readLine();
nombre[x]=nombre[x].toUpperCase();
do
{
System.out.println("Ingresa la primera calificacion:");
calificacion_1[x]=Integer.parseInt(br.readLine());
if(calificacion_1[x]>11 || calificacion_1[x]<1)
{
System.out.println("Favor de Ingresar valores no mayor a 10");
}
}while(calificacion_1[x]>11 || calificacion_1[x]<1);
do
{
System.out.println("Ingresa la segunda calificacion:");
calificacion_2[x]=Integer.parseInt(br.readLine());
if(calificacion_2[x]>11 || calificacion_2[x]<1);
{
System.out.println("Favor de Ingresar valores no mayor a 10");
}
}while(calificacion_2[x]>11 || calificacion_2[x]<1);
do{
System.out.println("Ingresa la tercera calificacion:");
calificacion_3[x]=Integer.parseInt(br.readLine());
if(calificacion_3[x]>11 || calificacion_3[x]<1)
{
System.out.println("Favor de Ingresar valores no mayor a 10");
}
}while(calificacion_3[x]>11|| calificacion_3[x]<1);
promedio[x]=(calificacion_1[x]+calificacion_2[x]+calificacion_3[x])/3;
if(promedio[x]>=6)
{
passed=passed+1;
}
if(promedio[x]<6)
{
flunked=flunked+1;
}
exitmenu=1;
}
if(op_menu==2)
{
System.out.println("Consultar Promedios");
for(x=1; x<totales; x++)
{
for(y=1; y<totales; y++)
{
if(promedio[y]<promedio[y+1])
{
aux=promedio[y];
promedio[y]=promedio[y+1];
promedio[y+1]=aux;
auxnombre=nombre[y];
nombre[y]=nombre[y+1];
nombre[y+1]=auxnombre;
}
}
}
exitmenu=1;
System.out.print(totales);
for(x=1; x<totales; x++)
{
System.out.println("Nombre del alumno o alumna: "+nombre[x]+" Promedio Final: "+promedio[x]);
}
}
if(op_menu==3)
{
System.out.println("Salida del programa \n Estos son los resultados");
System.out.println("No. de Reprobados: "+flunked);
System.out.println("No. de Aprobados: "+passed);
}
}while(exitmenu==1);
}/*cierre del if menu 2*/
}/*cierre de if opcion_menu*/