Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication28;
- import java.util.*;
- /**
- *
- * @author Cryorus
- * Calculos de promedio IP CIISA
- */
- public class Main {
- public static void main(String[] args) {
- Scanner entrada = new Scanner(System.in);
- System.out.print("Ingrese total de notas: ");
- short total = entrada.nextShort();
- short notas[]; notas = new short[total];
- short porc[]; porc = new short[total];
- short promedio = 0;
- System.out.println("Formato de notas: 10, 15, 70\nSi la nota es desconocida ingrese nota 0");
- for(short i = 0; i < notas.length; i++){
- System.out.print("Ingrese nota " + (i+1) + ": ");
- notas[i] = entrada.nextShort();
- System.out.print("Ingrese porcentaje de nota " + (i+1) + ": ");
- porc[i] = entrada.nextShort();
- }
- for(short i = 0; i < notas.length; i++) {
- if(notas[i]!=0) {
- promedio += notas[i]*porc[i];
- }
- }
- for(short i = 0; i < notas.length; i++) {
- if(notas[i] == 0) {
- for(short n = 1; n <= 70; n++) {
- short promedio2 = promedio;
- promedio2 += n*porc[i];
- if(promedio2/100 >= 40) {
- System.out.println("La nota necesaria es: " + n);
- break;
- }
- else {
- promedio2 = promedio;
- }
- }
- }
- }
- System.out.println("Promedio: " + promedio/100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement