Está en la página 1de 4

public class Nota1 {

public static final int N = 5;


public static String [] Estudiante= new String[N];
public static double [] nota = new double [N];
public static Scanner entrada =new Scanner (System.in);
public static void main(String[] args){
//INICIO MAIN
almacenarDatos ();
int opcion =0 ;
while (opcion !=11 ){
System.out.println(" ESTE ES UN PROGRAMA QUE CALCULA LAS
NOTAS ");
System.out.println("SEGUN LA OPCION QUE ELIJIA ");
System.out.println("SELECCIONE ALGUNA OPCION");
System.out.println("1. NOMBRE ESTUDIANTES PSAROM");
System.out.println("2. NOMBRE ESTUDIANTES PERDIERON ");
System.out.println("3. PROMEDIO DEL CURSO ");
System.out.println("4. CONCTAR ESTUDIANTES QUE TIENE LA
NOTA SUPERIOR AL PROMEDIO ");
System.out.println("5. DAR NOMBRE ESTUDIANTES NOTA INFER
IRO AL PROMEDIO");
System.out.println("6. PORCENTAJE ESTUDIANTES QUE PASARO
N LA MATERIA");
System.out.println("7.PORSENTAJE ESTUDIANTES QUE PERDIER
ON LA MATERIA");
System.out.println("8. NOMVRE ESTUDIANTE CON MAYOR NOTA
FIAL");
System.out.println("9. NOMBRE NOTAS SUPERIORES A 4.5 ");
System.out.println("10 . LISTA DE NOTAS ");
System.out.println("11. SALIR DEL PROGRAMA ");
opcion=entrada.nextInt();
switch (opcion){
case 1 :
estudiantesPasaron();
break;
case 2 :
estudiantesPerdieron();
break;
case 3 :
double resultado= Promedio();
System.out.println("El promedio del curso es de
"+resultado);
Promedio ();
break;
case 4 :
estudiantesPasaron();
break;
case 5 :
estudiantesPerdieron();
break;
case 6 :
porcentajepas();
break;
case 7:
porcentajePer();
break;
case 8:
mayor ();
break;

case 9:
alumnomejor ();
break;
case 10 :
almacenarDatos ();
break;
case 11 :
darDespedida();
break;
default :
System.out.println("OPCION INVALIDA ");
} //cierre swuich
}//cierre while
}//cierre main
public static void almacenarDatos (){
Estudiante [0]="juan" ; nota [0]= 3.5;
Estudiante[1]="paula";nota [1]= 2.0;
Estudiante [2]="laura" ;nota [2]=4.7;
Estudiante [3]="pedro";nota [3]=1.2;
Estudiante [4]="david";nota [4]=5;
}
public static void darDespedida (){ System.out.println();
System.out.println("---------------------------------------");
System.out.println("GRACIAS POR USAR NUESTRO SOFWARE ");
System.out.println("-----------------------------------");
System.exit(0);
}
public static void menor(){
System.out.println("----------------------------------------------");
String nombre = Estudiante[0];
double menor =nota[0];
for (int i=0;i<N;i++){
if (nota[i]<menor){
menor = nota[i];
nombre = Estudiante [i];
}
}
System.out.println("El estudiante de con menor nota es pedro
");
System.out.println(nombre + " "+ "cuyo nota es de " + menor);
System.out.println("------------------------------------------------");
}
public static double Promedio () {

double suma = 0;
for (int i=0; i<N; i++){
suma = suma + nota[i];}
return suma/N;
}
public static void mayor (){
System.out.println("----------------------------------------------");
String nombre1 = Estudiante[0];
double mayor1 =nota[0];
for (int i=0;i<N;i++){
if (nota[i]>mayor1){
mayor1 = nota[i];
nombre1 = Estudiante [i];
}
System.out.println("El estudiante de con mayor nota es
pedro ");
System.out.println(nombre1 + " "+ "cuyo nota es de " +
mayor1);
System.out.println(" ----------------------------------------");
}
}
public static double PromedioFin(){
return Promedio()/N ;
}
public static void estudiantesPasaron(){
double b = 3.0;
for (int i=0; i<N ;i++){
if (nota[i]>=b){
System.out.printf("%-10s ",Estudiante [i],nota[
i]);}
}}
public static void estudiantesPerdieron(){
double b = 3.0;
for (int i=0; i<N ;i++){
if (nota[i]<=b){
System.out.printf("%-15s %2s %10.1f %n ",Estud
iante[i],nota[i]);}
}
}
public static double porcentajepas(){
double c = 0;
double b = 3.0;
for (int i=0; i< N ; i++){
if(nota[i]>=b){
c++
;
}
}
return (c/N)*100;
}
public static double porcentajePer(){

double c = 0;
double b = 3.0;
for (int i=0; i< N ; i++){
if(nota[i]<=b){
c++;
}
}
return (c/N)*100;
}
public static double mayorPromedio(){
double c = 0;
for (int i=0; i< N ; i++){
if(nota[i]>Promedio()){
c++;
}
}
return c;
}
public static void alumnomayorpromedio(){
for (int i=0; i<N ;i++){
if (nota[i]>Promedio()){
System.out.printf("%-15s %2s %10.1f %n ",Estud
iante[i],nota[i]);}
}
}

public static void alumnomejor (){


double m = 4.5;
for (int i=0; i<N ;i++){
if (nota[i]>m){
System.out.printf("%-15s %2s %10.1f %n ",Estud
iante[i],nota[i]);}
}}}

//cierre Porogra

También podría gustarte