-
Lenguaje
Java usando Scanner
-
Descripción
Calcular la nota definitiva de un estudiante de matemáticas. Se deben leer las siguientes notas por pantalla: seguimiento 60%, parc1 20% y parc2 20%. Al final debe imprimir un mensaje que indique si ganó o perdió la materia.
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;
public class NotaDefinitivaDeMatematicas {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double nota_definitiva, parc1, parc2, seguimiento;
System.out.print("Ingresa el valor de parc1: ");
parc1 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de parc2: ");
parc2 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de seguimiento: ");
seguimiento = in.nextDouble();
in.nextLine();
nota_definitiva=seguimiento*0.6+parc1*0.2+parc2*0.2;
if(nota_definitiva<7)
System.out.println("Perdi\u00F3 la materia.");
else
System.out.println("Gan\u00F3 la materia.");
System.out.println("Valor de nota definitiva: " + nota_definitiva);
}
}
public class NotaDefinitivaDeMatematicas {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double nota_definitiva, parc1, parc2, seguimiento;
System.out.print("Ingresa el valor de parc1: ");
parc1 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de parc2: ");
parc2 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de seguimiento: ");
seguimiento = in.nextDouble();
in.nextLine();
nota_definitiva=seguimiento*0.6+parc1*0.2+parc2*0.2;
if(nota_definitiva<7)
System.out.println("Perdi\u00F3 la materia.");
else
System.out.println("Gan\u00F3 la materia.");
System.out.println("Valor de nota definitiva: " + nota_definitiva);
}
}