Skip to content

Instantly share code, notes, and snippets.

@EmmaG2
Last active July 8, 2022 05:43
Show Gist options
  • Save EmmaG2/3748f4edc5812656305df557ffca0043 to your computer and use it in GitHub Desktop.
Save EmmaG2/3748f4edc5812656305df557ffca0043 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
float[] notes = new float[3];
String name;
Scanner scann = new Scanner(System.in);
System.out.println("Ingrese el nombre del alumno");
name = scann.nextLine();
System.out.println("Ingrese las 3 calificaciones");
for (int i = 0; i < notes.length; i++) {
notes[i] = scann.nextFloat();
}
System.out.println("Nombre: " + name);
for (int i = 0; i < notes.length; i++) {
System.out.println("Materia " + (i + 1) + ": Promedio: " + notes[i]);
}
System.out.println(verifyNotes(notes));
}
public static String verifyNotes(float[] notes) {
float result = Math.round((notes[0] + notes[1] + notes[2]) / 3);
System.out.println("Promedio final: " + result + "\n");
// se requiere mínimo un 6 en cada materia para sumar 18 puntos y pasar el añor
if (result >= 6) return "Aprobaste";
return "No pasaste bro";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment