• Lenguaje

    Java usando Scanner

  • Descripción

    Preguntar el número de estudiantes que hay en un curso, luego de ello ingresar las tres notas de cada estudiante e ir imprimiendo su nota final, tenga presente que la primera nota es el 30%, la segunda el 30% y la tercera el 40% y que las notas van de 0-5.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.Scanner;

public class NotaFinalDeEstudiantes {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int i, n;
        double nota_1, nota_2, nota_3, nota_final;
        System.out.print("Ingresa el valor de n: ");
        n = in.nextInt();
        in.nextLine();
        for (i=1; i<=n; i++) {
            System.out.print("PROCESO " + i);
            System.out.print("Ingresa el valor de nota 1: ");
            nota_1 = in.nextDouble();
            in.nextLine();
            System.out.print("Ingresa el valor de nota 2: ");
            nota_2 = in.nextDouble();
            in.nextLine();
            System.out.print("Ingresa el valor de nota 3: ");
            nota_3 = in.nextDouble();
            in.nextLine();
            nota_final=nota_1*0.3+nota_2*0.3+nota_3*0.4;
            System.out.println("Valor de nota final: " + nota_final);
            System.out.println();
        }
    }

}