Sei sulla pagina 1di 8

ESCUELA POLITÉCNICA NACIONAL

FACULTAD DE INGENIERÍA DE SISTEMAS


INGENIERÍA EN SISTEMAS DE COMPUTACIÓN
PERÍODO ACADÉMICO: 2019B
ASIGNATURA: POO
PROFESOR: Maritzol Tenemaza
TIPO DE INSTRUMENTO: Trabajo N1 _IIB
FECHA DE ENTREGA: 18/12/2019
Nombre:
Identificación: 201821384
El siguiente programa organiza la entrada de vehículos, vegetales y personas

Código fuente:
Main:
public static void main(String[] args) {
JFrame frame=new JFrame();
frame.setVisible(true);
}
JFrame
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

try{

Arbol arbol =new Arbol(b.getText(),Integer.parseInt(d.getText() ), a.getText(),


Double.parseDouble(c.getText()));

arbol.setOpinion(f.getText());

lista.agregarVegetal(arbol);

}catch (Exception e){

JOptionPane.showMessageDialog(null, "Ingrese datos válidos");

Arbol arbol =new Arbol(b.getText(),Integer.parseInt(d.getText() ), a.getText(),


Double.parseDouble(c.getText()));

arbol.setOpinion(f.getText());

lista.agregarVegetal(arbol);

String t="";
a.setText(t);

b.setText(t);

c.setText(t);

d.setText(t);

f.setText(t);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

try{

Arbusto arbusto =new Arbusto(b1.getText(),Integer.parseInt(d1.getText() ), a1.getText(), c1.getText());

arbusto.setOpinion(f2.getText());

lista.agregarVegetal(arbusto);

}catch (Exception e){

JOptionPane.showMessageDialog(null, "Ingrese datos válidos");

Arbusto arbusto =new Arbusto(b1.getText(),Integer.parseInt(d1.getText() ), a1.getText(), c1.getText());

arbusto.setOpinion(f2.getText());

lista.agregarVegetal(arbusto);

String t="";

a1.setText(t);

b1.setText(t);

c1.setText(t);

d1.setText(t);

f2.setText(t); // TODO add your handling code here:

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {

try{

Coche coche =new


Coche(b5.getText(),a5.getText(),Integer.parseInt(c5.getText()),Integer.parseInt(jTextField1.getText()));

coche.setNombre(d5.getText());

coche.setOpinion(f6.getText());

lista.agregarVehiculo(coche);
}catch (Exception e){

JOptionPane.showMessageDialog(null, "Ingrese datos válidos");

Coche coche =new


Coche(b5.getText(),a5.getText(),Integer.parseInt(c5.getText()),Integer.parseInt(jTextField1.getText()));

coche.setNombre(d5.getText());

coche.setOpinion(f6.getText());

lista.agregarVehiculo(coche);

String t="";

a5.setText(t);

b5.setText(t);

c5.setText(t);

d5.setText(t);

f6.setText(t);

jTextField1.setText(t);

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {

try{

Estudiante estudiante =new Estudiante


(a6.getText(),Integer.parseInt(b6.getText()),c6.getText(),Double.parseDouble(d6.getText()));

estudiante.setOpinion(f7.getText());

estudiante.disponibleProfesor();

lista.agregarPersona(estudiante);

}catch(Exception e){

JOptionPane.showMessageDialog(null, "Ingrese datos válidos");

Estudiante estudiante =new Estudiante


(a6.getText(),Integer.parseInt(b6.getText()),c6.getText(),Double.parseDouble(d6.getText()));

estudiante.setOpinion(f7.getText());

estudiante.disponibleProfesor();

lista.agregarPersona(estudiante);

String t="";

a6.setText(t);
b6.setText(t);

c6.setText(t);

d6.setText(t);

f7.setText(t);

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {

try{

Profesor profesor=new Profesor(a7.getText(),Integer.parseInt(b7.getText()),c7.getText());

profesor.setOpinion(f8.getText());

lista.agregarPersona(profesor);

}catch(Exception e){

JOptionPane.showMessageDialog(null, "Ingrese datos válidos");

Profesor profesor=new Profesor(a7.getText(),Integer.parseInt(b7.getText()),c7.getText());

profesor.setOpinion(f8.getText());

lista.agregarPersona(profesor);

String t="";

a7.setText(t);

b7.setText(t);

c7.setText(t);

f8.setText(t);

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {

try{

Bicicleta bicileta=new Bicicleta(b8.getText(),a8.getText(),Integer.parseInt(c8.getText()));

bicileta.setOpinion(f9.getText());

bicileta.setNombre(d7.getText());

lista.agregarVehiculo(bicileta);
}catch(Exception e){

JOptionPane.showMessageDialog(null, "Ingrese datos válidos");

Bicicleta bicileta=new Bicicleta(b8.getText(),a8.getText(),Integer.parseInt(c8.getText()));

bicileta.setOpinion(f9.getText());

bicileta.setNombre(d7.getText());

lista.agregarVehiculo(bicileta);

String t="";

a8.setText(t);

b8.setText(t);

c8.setText(t);

d7.setText(t);

f9.setText(t);

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {

JFramevegetales listper= new JFramevegetales();

listper.setVisible(true); // TODO add your handling code here:

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {

JFramepersonas listper= new JFramepersonas();

listper.setVisible(true);

private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {

JFramevehiculos listper= new JFramevehiculos ();

listper.setVisible(true); // TODO add your handling code here:

private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {

JFrametodas listper= new JFrametodas ();


listper.setVisible(true);

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(JFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(JFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(JFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(JFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

//</editor-fold>
/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new JFrame().setVisible(true);

});

JFramepersonas
public JFramepersonas() {

initComponents();

this.setLocationRelativeTo(this);

jTextArea1.setText(JFrame.lista.toStringPersona());

}}

JFrametodas
JFramevegetal
JFramevehiculos
Interface Actor
public interface Actor {

Actor setOpinion(String opinion);

}
Interface ObjetoInerte
Abstract Persona

¿Qué aprendí?
Herencia e implementación

Bibliografía:

_____________

Potrebbero piacerti anche