saludos amigos
aqui les dejo PARTE del codigo que desarrolle para mi proyecto,
les dejo solo las partes que me parecieron mas dificil con pocos comentarios para que se esfuersen un poco en entender y no pase lo que paso con la ecuacion de segundo grado (muchos las copiaron y la entregaron tal cual, el profesor me llamo la atención)
aqui les va:
//ancho de banda 10
cli.append(nombreRouter+"(config-if)#speed 10"+"\n");
//encender y apgar la interface
int conta;
conta++;
if(conta % 2==0){
cli.append(nombreRouter+"(config-if)#shutdown"+"\n");
} else{
cli.append(nombreRouter+"(config-if)#no shutdown"+"\n");
}
// agregar direccion ip
a = Integer.parseInt(ip1.getText());
b = Integer.parseInt(ip2.getText());
c = Integer.parseInt(ip3.getText());
d = Integer.parseInt(ip4.getText());
if (a == 0 && b == 0 && c == 0 && d == 0){
cli.append(nombreRouter+"(config-if)#no ip address "+"\n");
}
else{
if(a <= 255 && a >= 0 && b <= 255 && b >= 0 && c <= 255 && c >= 0 && d <= 255 && d >= 0 ){
cli.append(nombreRouter+"(config-if)#ip address "+a+"."+b+"."+c+"."+d+" "+mascara.getSelectedItem()+"\n");
} else{
errorip.setVisible(true);
}
}}
// boton agregar ruta estatica
if(a <= 255 && a >= 0 && b <= 255 && b >= 0 && c <= 255 && c >= 0 && d <= 255 && d >= 0 ){
if(e == 0 && f==0&& g == 0 && h == 0){
System.out.println("direccion de siguiente salto no valida");
} else{
if (a==0 && b==0&& c==0&&d==0){
if (contadefault ==0){
contadefault++;
staticroute.append("default via "+e+"."+f+"."+g+"."+h+" "+"\n");
cli.append(nombreRouter+"(config)#ip route "+a+"."+b+"."+c+"."+d+" "+"0.0.0.0"+" "+e+"."+f+"."+g+"."+h+" "+"\n");
}
else{
System.out.println("solo puede haber una ruta por defecto");
}
}
else{
cli.append(nombreRouter+"(config)#ip route "+a+"."+b+"."+c+"."+d+" "+mascara1.getSelectedItem()+" "+e+"."+f+"."+g+"."+h+" "+"\n");
if(e <= 255 && e >= 0 && f <= 255 && f >= 0 && g <= 255 && g >= 0 && h <= 255 && h >= 0 ){
if (mascara1.getSelectedItem() == "255.0.0.0"){
staticroute.append(a+"."+b+"."+c+"."+d+"/8 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.0.0"){
staticroute.append(a+"."+b+"."+c+"."+d+"/16 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.0"){
staticroute.append(a+"."+b+"."+c+"."+d+"/24 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.128"){
staticroute.append(a+"."+b+"."+c+"."+d+"/25 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.192"){
staticroute.append(a+"."+b+"."+c+"."+d+"/26 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.224"){
staticroute.append(a+"."+b+"."+c+"."+d+"/27 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.240"){
staticroute.append(a+"."+b+"."+c+"."+d+"/28 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.248"){
staticroute.append(a+"."+b+"."+c+"."+d+"/29 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.252"){
staticroute.append(a+"."+b+"."+c+"."+d+"/30 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
if (mascara1.getSelectedItem() == "255.255.255.254"){
staticroute.append(a+"."+b+"."+c+"."+d+"/31 via "+e+"."+f+"."+g+"."+h+" "+"\n");
}
}
else{
// errorip.setVisible(true);
System.out.println("direccion de siguiente salto no valida");
//boton agregar rip
if (a == 0 && b == 0 && c == 0 && d == 0){
System.out.println("Direccion de red no valida");
// cli.append(nombreRouter+"(config-if)#no ip address "+"\n");
}
else{
if(a <= 255 && a >= 0 && b <= 255 && b >= 0 && c <= 255 && c >= 0 && d <= 255 && d >= 0 ){
cli.append(nombreRouter+"(config-router)#network "+a+"."+b+"."+c+"."+d+" "+"\n");
rip.append(a+"."+b+"."+c+"."+d+" "+"\n");
} else{
errorip.setVisible(true);
}
}}
catch(Exception e){
cli.append(nombreRouter+" "+niveltex+"#end"+"\n");
cli.append(nombreRouter+"(config)#router rip"+"\n");
cli.append(nombreRouter+"(config-router)#"+"\n");
nivel=10;
errorip.setVisible(true);
}
domingo, 27 de marzo de 2011
martes, 15 de marzo de 2011
Calcular ecuacion de segundo grado en java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author rb34
*/
//import java.awt.*;
import java.awt.Color;
import javax.swing.*;
public class ecuacion extends JFrame{
// static JFrame ventana = new JFrame("ventana");
static JButton procesar = new JButton();
static JButton borrar = new JButton();
static JLabel a = new JLabel("a");
static JLabel b = new JLabel("b");
static JLabel c = new JLabel("c");
static JLabel x = new JLabel("x");
static JLabel y = new JLabel("y");
static JTextField texta = new JTextField();
static JTextField textb = new JTextField();
static JTextField textc = new JTextField();
static JTextField textx = new JTextField();
static JTextField texty = new JTextField();
public ecuacion(){
initComponents();
}
private void initComponents(){
this.setTitle("ecuacion2");
this.setSize(500, 160);
this.setResizable(false);
this.setLayout(null);
//this.setBackground(Color.red);
procesar.setLabel("procesar");
procesar.setBounds(10, 80, 100, 30);
procesar.setBackground(Color.blue);
add(procesar);
borrar.setLabel("borrar");
borrar.setBounds(300, 80, 100, 30);
borrar.setBackground(Color.CYAN);
add(borrar);
a.setBounds(10, 10, 10, 20);
texta.setBounds(30, 10, 50, 20);
add(a);
add(texta);
b.setBounds(10, 30, 10, 20);
textb.setBounds(30, 30, 50, 20);
add(b);
add(textb);
c.setBounds(10, 50, 10, 20);
textc.setBounds(30, 50, 50, 20);
add(c);
add(textc);
x.setBounds(300, 10, 10, 20);
textx.setBounds(310, 10, 50, 20);
add(x);
add(textx);
y.setBounds(300, 30, 10, 20);
texty.setBounds(310, 30, 50, 20);
add(y);
add(texty);
this.setVisible(true);
}
public static void main(String args[]){
ecuacion demo =new ecuacion();
}
}
class evento2 implements ActionListener{
ecuacion local;
int a,b,c;
double z;
public evento2( ecuacion para){
local = para;
}
public void actionPerformed(ActionEvent evento2){
if (evento2.getSource()==local.procesar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
c = Integer.parseInt(local.textc.getText());
//z=Math.sqrt((b*b)+(-4*a*c));
local.textx.setText(" "+((-b+Math.sqrt((b*b)+(-4*a*c)))/(2*a)));
local.texty.setText(" "+((-b-Math.sqrt((b*b)+(-4*a*c)))/(2*a)));
}
if (evento2.getSource()==local.borrar){
local.texta.setText(null);
local.textb.setText(null);
local.textc.setText(null);
local.textx.setText(null);
local.texty.setText(null);
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author rb34
*/
//import java.awt.*;
import java.awt.Color;
import javax.swing.*;
public class ecuacion extends JFrame{
// static JFrame ventana = new JFrame("ventana");
static JButton procesar = new JButton();
static JButton borrar = new JButton();
static JLabel a = new JLabel("a");
static JLabel b = new JLabel("b");
static JLabel c = new JLabel("c");
static JLabel x = new JLabel("x");
static JLabel y = new JLabel("y");
static JTextField texta = new JTextField();
static JTextField textb = new JTextField();
static JTextField textc = new JTextField();
static JTextField textx = new JTextField();
static JTextField texty = new JTextField();
public ecuacion(){
initComponents();
}
private void initComponents(){
this.setTitle("ecuacion2");
this.setSize(500, 160);
this.setResizable(false);
this.setLayout(null);
//this.setBackground(Color.red);
procesar.setLabel("procesar");
procesar.setBounds(10, 80, 100, 30);
procesar.setBackground(Color.blue);
add(procesar);
borrar.setLabel("borrar");
borrar.setBounds(300, 80, 100, 30);
borrar.setBackground(Color.CYAN);
add(borrar);
a.setBounds(10, 10, 10, 20);
texta.setBounds(30, 10, 50, 20);
add(a);
add(texta);
b.setBounds(10, 30, 10, 20);
textb.setBounds(30, 30, 50, 20);
add(b);
add(textb);
c.setBounds(10, 50, 10, 20);
textc.setBounds(30, 50, 50, 20);
add(c);
add(textc);
x.setBounds(300, 10, 10, 20);
textx.setBounds(310, 10, 50, 20);
add(x);
add(textx);
y.setBounds(300, 30, 10, 20);
texty.setBounds(310, 30, 50, 20);
add(y);
add(texty);
this.setVisible(true);
}
public static void main(String args[]){
ecuacion demo =new ecuacion();
}
}
class evento2 implements ActionListener{
ecuacion local;
int a,b,c;
double z;
public evento2( ecuacion para){
local = para;
}
public void actionPerformed(ActionEvent evento2){
if (evento2.getSource()==local.procesar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
c = Integer.parseInt(local.textc.getText());
//z=Math.sqrt((b*b)+(-4*a*c));
local.textx.setText(" "+((-b+Math.sqrt((b*b)+(-4*a*c)))/(2*a)));
local.texty.setText(" "+((-b-Math.sqrt((b*b)+(-4*a*c)))/(2*a)));
}
if (evento2.getSource()==local.borrar){
local.texta.setText(null);
local.textb.setText(null);
local.textc.setText(null);
local.textx.setText(null);
local.texty.setText(null);
}
}
}
Etiquetas:
ecuacion de segundo grado,
java,
java "lenguaje java"
sábado, 12 de marzo de 2011
Calculadora en Java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author rb34
*/
import java.awt.Color;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class calculadora extends JFrame{
// static JFrame ventana = new JFrame("ventana");
JButton procesar = new JButton();
JButton borrar = new JButton();
JButton dividir = new JButton();
JButton multiplicar = new JButton();
JLabel a = new JLabel("a");
JLabel b = new JLabel("b");
JLabel c = new JLabel("c");
JLabel x = new JLabel("x");
JLabel y = new JLabel("y");
JTextField texta = new JTextField();
JTextField textb = new JTextField();
JTextField textc = new JTextField();
JTextField textx = new JTextField();
JTextField texty = new JTextField();
public calculadora(){
initComponents();
}
private void initComponents(){
this.setTitle("calculadora");
this.setSize(500, 160);
//this.setResizable(false);
this.setLayout(null);
//this.setBackground(Color.red);
procesar.setLabel("+");
procesar.setBounds(10, 80, 100, 30);
procesar.setBackground(Color.CYAN);
procesar.addActionListener(new evento(this));
add(procesar);
borrar.setLabel("-");
borrar.setBounds(115, 80, 100, 30);
borrar.setBackground(Color.CYAN);
borrar.addActionListener(new evento(this));
add(borrar);
multiplicar.setLabel("*");
multiplicar.setBounds(220, 80, 100, 30);
multiplicar.setBackground(Color.CYAN);
multiplicar.addActionListener(new evento(this));
add(multiplicar);
dividir.setLabel("/");
dividir.setBounds(325, 80, 100, 30);
dividir.setBackground(Color.CYAN);
dividir.addActionListener(new evento(this));
add(dividir);
a.setBounds(10, 10, 10, 20);
texta.setBounds(30, 10, 50, 20);
add(a);
add(texta);
b.setBounds(10, 30, 10, 20);
textb.setBounds(30, 30, 50, 20);
add(b);
add(textb);
c.setBounds(10, 50, 10, 20);
textc.setBounds(30, 50, 50, 20);
add(c);
add(textc);
/*
x.setBounds(300, 10, 10, 20);
textx.setBounds(310, 10, 50, 20);
add(x);
add(textx);
y.setBounds(300, 30, 10, 20);
texty.setBounds(310, 30, 50, 20);
add(y);
add(texty);
*/
//pack();
this.setVisible(true);
}
public static void main(String args[]){
calculadora demo =new calculadora();
}
}
class evento implements ActionListener{
calculadora local;
int a,b;
public evento(calculadora par){
local = par;
}
public void actionPerformed(ActionEvent evento){
if (evento.getSource()==local.procesar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a+b));
}
if (evento.getSource()==local.borrar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a-b));
}
if (evento.getSource()==local.multiplicar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a*b));
}
if (evento.getSource()==local.dividir){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a/b));
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author rb34
*/
import java.awt.Color;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class calculadora extends JFrame{
// static JFrame ventana = new JFrame("ventana");
JButton procesar = new JButton();
JButton borrar = new JButton();
JButton dividir = new JButton();
JButton multiplicar = new JButton();
JLabel a = new JLabel("a");
JLabel b = new JLabel("b");
JLabel c = new JLabel("c");
JLabel x = new JLabel("x");
JLabel y = new JLabel("y");
JTextField texta = new JTextField();
JTextField textb = new JTextField();
JTextField textc = new JTextField();
JTextField textx = new JTextField();
JTextField texty = new JTextField();
public calculadora(){
initComponents();
}
private void initComponents(){
this.setTitle("calculadora");
this.setSize(500, 160);
//this.setResizable(false);
this.setLayout(null);
//this.setBackground(Color.red);
procesar.setLabel("+");
procesar.setBounds(10, 80, 100, 30);
procesar.setBackground(Color.CYAN);
procesar.addActionListener(new evento(this));
add(procesar);
borrar.setLabel("-");
borrar.setBounds(115, 80, 100, 30);
borrar.setBackground(Color.CYAN);
borrar.addActionListener(new evento(this));
add(borrar);
multiplicar.setLabel("*");
multiplicar.setBounds(220, 80, 100, 30);
multiplicar.setBackground(Color.CYAN);
multiplicar.addActionListener(new evento(this));
add(multiplicar);
dividir.setLabel("/");
dividir.setBounds(325, 80, 100, 30);
dividir.setBackground(Color.CYAN);
dividir.addActionListener(new evento(this));
add(dividir);
a.setBounds(10, 10, 10, 20);
texta.setBounds(30, 10, 50, 20);
add(a);
add(texta);
b.setBounds(10, 30, 10, 20);
textb.setBounds(30, 30, 50, 20);
add(b);
add(textb);
c.setBounds(10, 50, 10, 20);
textc.setBounds(30, 50, 50, 20);
add(c);
add(textc);
/*
x.setBounds(300, 10, 10, 20);
textx.setBounds(310, 10, 50, 20);
add(x);
add(textx);
y.setBounds(300, 30, 10, 20);
texty.setBounds(310, 30, 50, 20);
add(y);
add(texty);
*/
//pack();
this.setVisible(true);
}
public static void main(String args[]){
calculadora demo =new calculadora();
}
}
class evento implements ActionListener{
calculadora local;
int a,b;
public evento(calculadora par){
local = par;
}
public void actionPerformed(ActionEvent evento){
if (evento.getSource()==local.procesar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a+b));
}
if (evento.getSource()==local.borrar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a-b));
}
if (evento.getSource()==local.multiplicar){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a*b));
}
if (evento.getSource()==local.dividir){
a = Integer.parseInt(local.texta.getText());
b = Integer.parseInt(local.textb.getText());
local.textc.setText(""+(a/b));
}
}
}
sábado, 5 de febrero de 2011
jueves, 23 de septiembre de 2010
Cisco CCNA ESP
aca les dejo los 4 modulos de Cisco CCNA en formato HTML, en español, estos son los mismos usados en las academias para impartir los cursos y los publicados por cisco, espero que les sea de utilidad.
CCNA Exploration v4.0 MODULE 1 ESP.zip
CCNA Exploration v4.0 MODULE 2 ESP.zip
CCNA Exploration v4.0 MODULE 3 ESP.zip
CCNA Exploration v4.0 MODULE 4 ESP.zip
aca les dejo Packet tracer para que hagan las simulaciones correspondientes al los cursos y otras cosas que quieran simular.
PackectTracer Linux
PacketTracer Gindows
CCNA Exploration v4.0 MODULE 1 ESP.zip
CCNA Exploration v4.0 MODULE 2 ESP.zip
CCNA Exploration v4.0 MODULE 3 ESP.zip
CCNA Exploration v4.0 MODULE 4 ESP.zip
aca les dejo Packet tracer para que hagan las simulaciones correspondientes al los cursos y otras cosas que quieran simular.
PackectTracer Linux
PacketTracer Gindows
Etiquetas:
CCNA,
CCNA Exploration,
CCNA HTML,
Cisco,
PacketTracer,
PacketTracer linux
miércoles, 9 de junio de 2010
miércoles, 26 de mayo de 2010
Electricidad y magnetismo
Laminas, ejercicios y parciales Electricidad y Magnetismo
electricidad y magnetismo 1.ppt
electricidad y magnetismo 2.ppt
electricidad y magnetismo 3.ppt
electricidad y magnetismo 4.ppt
electricidad y magnetismo 5.ppt
electricidad y magnetismo 6.ppt
Sesion 7.ppt
Sesion 8.ppt
Ejercicios.ppt
Ejercicios 2.ppt
Ejercicios 3.ppt
Ejercicios 4.ppt
Ejercicios.docx
Quiz Nro 1.doc
Parcial 1.doc
Parcial 2.doc
Parcial 3.doc
Parcial 4.doc
Parcial 5.doc
Parcial 6.doc
Parcial 7.doc
Parcial 8.doc
Parcial 9.doc
Parcial 10.doc
Parcial 11.docx
2do Parcial.doc
Aprobatorio.doc
electricidad y magnetismo 1.ppt
electricidad y magnetismo 2.ppt
electricidad y magnetismo 3.ppt
electricidad y magnetismo 4.ppt
electricidad y magnetismo 5.ppt
electricidad y magnetismo 6.ppt
Sesion 7.ppt
Sesion 8.ppt
Ejercicios.ppt
Ejercicios 2.ppt
Ejercicios 3.ppt
Ejercicios 4.ppt
Ejercicios.docx
Quiz Nro 1.doc
Parcial 1.doc
Parcial 2.doc
Parcial 3.doc
Parcial 4.doc
Parcial 5.doc
Parcial 6.doc
Parcial 7.doc
Parcial 8.doc
Parcial 9.doc
Parcial 10.doc
Parcial 11.docx
2do Parcial.doc
Aprobatorio.doc
Suscribirse a:
Entradas (Atom)