elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


  Mostrar Temas
Páginas: [1]
1  Programación / Java / Registras notas alumnos en array con Swing en: 15 Noviembre 2014, 04:06 am

Hola, tengo que hacer la siguiente tarea:

Ítem I.-

Enunciado:

Un instituto Profesional  requiere una aplicación que le permita registrar y controlar las notas de un curso.

Use clase JFrame y los artefactos necesarios ( JLabel, JtextField, etc.)

a)   Use una matriz numérica de 10x5 para registrar la notas:

•   Solemne1, Solemne2, NotaP, Examen, NotaFinal

Datos ingresados:   Solemne1, Solemne2, Examen

Datos Calculados:

•   NotaP = promedio de solemnes
•   NotaFinal= 70% NotaP, 39% Examen.

b)   Use un arreglo de caracteres para registrar los nombres de alumnos,

Nota: Los alumnos se identifican con el número de subíndice
 
Se pide:

1.- Construir clase extendida de JFrame.

 Los siguientes métodos:

2.- Ingreso de nombres en el arreglo Alumnos

3.- Ingreso de Solemnes y cálculo de NotaP. Validar que las notas estén entre 1 y 7.

4.- Ingreso de Examen y cálculo de NotaFinal

5.- Listar alumnos aprobados y Nota Promedio de los aprobados.

6.- Listar Cantidad Aprobados, Reprobados y Promedio curso.

7.- Consultar notas finales de un alumno. Desplegar:

Índice, Nombre, Sol1, Sol2, NotaParcial, Examen, NotaFinal , Situación
“Aprobado” o “Reprobado” según corresponda.


aca tengo el codigo no me resulta:


Código
  1.  
  2.  
  3. import java.util.Scanner;
  4. import java.awt.*;
  5. import java.awt.event.*;
  6. import javax.swing.*;
  7.  
  8.  
  9. public class NotasAlumnos201 extends JFrame implements ActionListener {
  10.  
  11.    int largo = 5 ;
  12.    int i = 0;
  13.  
  14.    String ArrNombre[] = new String[largo];                                        
  15.    int b[] = new int[largo];
  16.  
  17.    JLabel etiqueta1, etiqueta2, etiqueta3;                                        
  18.    JTextField numero1, numero2, numero3, numero4;                                          
  19.    JButton boton1, boton2, boton3, boton4, boton5;
  20.  
  21.    public static void main(String[] args) {
  22.  
  23.        NotasAlumnos02 aplicacion = new NotasAlumnos02();
  24.        aplicacion.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  25.        aplicacion.setLocationRelativeTo(null);  
  26.  
  27.    }
  28.  
  29.    public NotasAlumnos201() {
  30.  
  31.        super("Registrar Notas");                     //  clase BurbujaSwing    sub clase de JFrame
  32.  
  33.        setLayout(null);
  34.        etiqueta1=new JLabel("Ingrese Nombre: ");
  35.        etiqueta1.setBounds(10,20,300,30);
  36.        add(etiqueta1);
  37.  
  38.        numero1=new JTextField();
  39.        numero1.setBounds(120,25,150,20);
  40.        add(numero1);
  41.  
  42.        numero2=new JTextField();
  43.        numero2.setBounds(120,55,60,20);
  44.        add(numero2);
  45.  
  46.        numero3=new JTextField();
  47.        numero3.setBounds(120,85,60,20);
  48.        add(numero3);
  49.  
  50.  
  51.        numero4=new JTextField();
  52.        numero4.setBounds(120,115,60,20);
  53.        add(numero4);
  54.  
  55.        etiqueta2=new JLabel("Nota Solemne 1: ");
  56.        etiqueta2.setBounds(10,50,100,30);
  57.        add(etiqueta2);
  58.  
  59.        etiqueta3=new JLabel("Nota Solemne 2: ");
  60.        etiqueta3.setBounds(10,80,100,30);
  61.        add(etiqueta3);
  62.  
  63.        etiqueta3=new JLabel("Nota Examen: ");
  64.        etiqueta3.setBounds(10,110,100,30);
  65.        add(etiqueta3);
  66.  
  67.  
  68.        boton1 = new JButton("Capturar");
  69.        boton1.setBounds(120,150,120,30);
  70.        boton1.addActionListener(this);
  71.        add(boton1);
  72.  
  73.  
  74.  
  75.  
  76.  
  77.        setSize(400, 250);       //   asume el contenedor
  78.        setVisible(true);       //   asume el contenedor  
  79.  
  80.    }
  81.  
  82.    public void actionPerformed(ActionEvent evento) {
  83.        if (evento.getSource() == boton1) {
  84.            System.out.println("Presionado");
  85.  
  86.            ArrNombre[i] = numero1.getText();
  87.            System.out.println(ArrNombre[i]);  
  88.  
  89.            int matriz[ ][ ] = new int[3][4];
  90.  
  91.            int nota1, nota2, examen;
  92.  
  93.            nota1 = Integer.parseInt(numero2.getText());
  94.            nota2 = Integer.parseInt(numero3.getText());
  95.            examen = Integer.parseInt(numero4.getText());
  96.  
  97.  
  98.  
  99.            for(int x=0;x<3;x++) {
  100.                    for(int y=0;y<4;y++) {
  101.                    matriz[x][y]=Integer.parseInt(numero2.getText());
  102.                    }
  103.            }
  104.  
  105.            for(int x=0;x<4;x++) {
  106.                    for(int y=0;y<3;y++) {
  107.                    System.out.println (matriz[x][y]+" "); }
  108.  
  109.            }
  110.  
  111.  
  112.  
  113.            i++;
  114.  
  115.            /*
  116.             numero1.setText("");
  117.             numero2.setText("");
  118.             numero3.setText("");
  119.             numero4.setText("");
  120.             */
  121.            JOptionPane.showMessageDialog(null, ArrNombre[0] + " Promedio: ");
  122.  
  123.             if (i == largo) {
  124.               JOptionPane.showMessageDialog(null, "Fin de Captura");
  125.            }
  126.  
  127.  
  128.        }
  129.  
  130.    }
  131.  
  132. }
  133.  

2  Foros Generales / Dudas Generales / Pseudolenguaje como se escribe el mod ?? en: 24 Junio 2013, 02:45 am
hola,

en muchos lenguajes de programacion se debe de anteponer una funcion para convertir el valor del mod en entero.

Pero en Pseudolenguaje escrito en papel como se transforma un valor decimal a entero para luego pasarlo al Mod.

Esta bien o mal que lo escribe en papel la siguiente sentencia asi:


valor = rut mod 10 ;

en ves de:

valor =  trunc(rut/10)




en Pseint se pone el trunc por ejemplo

Código
  1. Proceso Numero_Verificador.
  2. i <- 0
  3. h <- 2
  4. k <- 0
  5. suma <- 0
  6. escribir "Leer Rut"
  7. leer rut1
  8. rut <- rut1
  9. // aca se saca cuantos numeros tiene
  10. Repetir
  11. rut <- trunc(rut/10)
  12. i <- i + 1
  13. hasta que rut = 0
  14. Repetir
  15. Repetir
  16. x <- trunc(rut1/10)
  17. mod <- rut1 - (x*10)
  18. suma <- suma + (mod*h)
  19. rut1 <- x
  20. si mod <> 0 Entonces
  21. k <- k +1
  22. FinSi
  23. h <- h + 1
  24. hasta que h > 7
  25. h <- 2
  26. k <- k + 1
  27. hasta que k >= 8
  28. entera <- trunc(suma/11)
  29. mod1 <- suma -(entera * 11)
  30. verificador <- 11 - mod1
  31. si verificador > 9 entonces
  32. escribir "Su digito Verificador Es k"
  33. sino
  34. escribir "Su digito Verificador Es ", verificador
  35. FinSi
  36. FinProceso
  37.  
  38.  
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines