Created
April 12, 2016 03:40
-
-
Save titandiaz/bf58d7d205371b57a71f66bb26a0ba1f to your computer and use it in GitHub Desktop.
Notas cuantos pasaron
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class notas { | |
public static notas n; | |
double[] notas=new double[5]; | |
public notas() | |
{ | |
int pasaron=0; | |
posicion(); | |
pasaron=cuantosPasaron(); | |
System.out.println("Los que pasaron fueron = " + pasaron); | |
int menores=0; | |
menores= cuantosPeorQue(3); | |
} | |
public int cuantosPeorQue(int pos) | |
{ | |
double dato= notas[pos]; | |
int i; | |
for(i=0; i<notas.length; i++) | |
{ | |
if(notas[i]<notas[pos]); | |
{ | |
dato+=1; | |
} | |
} | |
} | |
public int cuantosPasaron() | |
{ | |
int valor=0; | |
int i; | |
for(i=0; i<notas.length; i++) | |
{ | |
if(notas[i]>=3.0) | |
{ | |
valor+=1; | |
} | |
} | |
return valor; | |
} | |
public void posicion() | |
{ | |
int i=0; | |
int j=0; | |
double mayor=0.0; | |
double operando1=0.0; | |
double operando2=0.0; | |
int ind1=0; | |
int ind2=0; | |
double valor=0.0; | |
notas[0]=2.0; | |
notas[1]=5.0; | |
notas[2]=4.0; | |
notas[3]=3.0; | |
notas[4]=1.0; | |
for(i=0; i<notas.length; i++) | |
{ | |
for(j=i+1; j<notas.length; j++) | |
{ | |
valor= notas[i]*notas[j]; | |
if(valor>mayor) | |
{ | |
mayor=valor; | |
operando1=notas[i]; | |
operando2=notas[j]; | |
ind1=i; | |
ind2=j; | |
} | |
} | |
} | |
System.out.println("El valor mayor es = " + mayor); | |
System.out.println("El operando 1 es = " + operando1); | |
System.out.println("El operando 2 es = " + operando2); | |
System.out.println("El indice 1 es = " + ind1); | |
System.out.println("El indice 2 es = " + ind2); | |
} | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
n=new notas(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment