Last active
July 8, 2022 05:43
-
-
Save EmmaG2/3748f4edc5812656305df557ffca0043 to your computer and use it in GitHub Desktop.
This file contains 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
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