diloentutospc

Calcular Nota Definitiva de un Estudiante

Sep 3rd, 2018
4,895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class NotaDef {
  4.    
  5.     double nota1, nota2, nota3;
  6.     double acu1, acu2, acu3, def;
  7.    
  8.     Scanner entrada = new Scanner(System.in);
  9.    
  10.     public void IngreseNotas() {
  11.         System.out.println("Por favor ingrese las notas del estudiante");
  12.         System.out.print("Ingrese nota 1: ");
  13.         nota1 = entrada.nextDouble();
  14.         System.out.print("Ingrese nota 2: ");
  15.         nota2 = entrada.nextDouble();
  16.         System.out.print("Ingrese nota 3: ");
  17.         nota3 = entrada.nextDouble();
  18.     }
  19.    
  20.     public void CalculoNotas() {
  21.         acu1 = nota1*0.35;
  22.         acu2 = nota2*0.35;
  23.         acu3 = nota3*0.30;
  24.         def = acu1 + acu2 + acu3;
  25.     }
  26.    
  27.     public void MostrarResultados() {
  28.         System.out.println("Nota 1: " + nota1);
  29.         System.out.println("Nota 2: " + nota2);
  30.         System.out.println("Nota 3: " + nota3);
  31.         System.out.println("Acumulado nota 1: " + acu1);
  32.         System.out.println("Acumulado nota 2: " + acu2);
  33.         System.out.println("Acumulado nota 3: " + acu3);
  34.         System.out.println("Nota definitiva: " + def);
  35.     }
  36.    
  37.     public void Mensaje() {
  38.         if(def >= 3 && def <=5) {
  39.             System.out.println("El estudiante aprueba");
  40.         }else {
  41.             if(def >= 1.9 && def <3) {
  42.                 System.out.println("El estudiante habilita");
  43.             }else {
  44.                 if(def >= 0 && def <1.9) {
  45.                     System.out.println("El estudiante reprueba");
  46.                 }else {
  47.                     System.out.println("Error en las notas ingresadas");
  48.                 }
  49.             }
  50.         }
  51.     }
  52.  
  53.     public static void main(String[] args) {
  54.         NotaDef fc = new NotaDef();
  55.         fc.IngreseNotas();
  56.         fc.CalculoNotas();
  57.         fc.MostrarResultados();
  58.         fc.Mensaje();
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment