Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class NotaDef {
- double nota1, nota2, nota3;
- double acu1, acu2, acu3, def;
- Scanner entrada = new Scanner(System.in);
- public void IngreseNotas() {
- System.out.println("Por favor ingrese las notas del estudiante");
- System.out.print("Ingrese nota 1: ");
- nota1 = entrada.nextDouble();
- System.out.print("Ingrese nota 2: ");
- nota2 = entrada.nextDouble();
- System.out.print("Ingrese nota 3: ");
- nota3 = entrada.nextDouble();
- }
- public void CalculoNotas() {
- acu1 = nota1*0.35;
- acu2 = nota2*0.35;
- acu3 = nota3*0.30;
- def = acu1 + acu2 + acu3;
- }
- public void MostrarResultados() {
- System.out.println("Nota 1: " + nota1);
- System.out.println("Nota 2: " + nota2);
- System.out.println("Nota 3: " + nota3);
- System.out.println("Acumulado nota 1: " + acu1);
- System.out.println("Acumulado nota 2: " + acu2);
- System.out.println("Acumulado nota 3: " + acu3);
- System.out.println("Nota definitiva: " + def);
- }
- public void Mensaje() {
- if(def >= 3 && def <=5) {
- System.out.println("El estudiante aprueba");
- }else {
- if(def >= 1.9 && def <3) {
- System.out.println("El estudiante habilita");
- }else {
- if(def >= 0 && def <1.9) {
- System.out.println("El estudiante reprueba");
- }else {
- System.out.println("Error en las notas ingresadas");
- }
- }
- }
- }
- public static void main(String[] args) {
- NotaDef fc = new NotaDef();
- fc.IngreseNotas();
- fc.CalculoNotas();
- fc.MostrarResultados();
- fc.Mensaje();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment