martes, 2 de diciembre de 2008

Aplicación Prueba de Caja Blanca

A continuiación se representa en forma de Grafos todas las decisiones lógicas intervenidas en el programa; los posibles bucles que intervienen en el desarrollo de procesos y se Representa en forma de Diagrama de Flujo Datos general del aplicativo en los comentarios simbolizados por los //

GraCuad.java

//para la función cuadrática se debe crear GraCuad.java

import java.awt.*;
import java.applet.Applet;
public class GraficoCuad extends Applet {
int x0,xN,y0,yN;
double xmin,xmax,ymin,ymax;
int apAncho,apAlto;
public void init() {
Dimension d = size();
apAncho = d.width;
apAlto = d.height;
x0 = y0 = 0;
xN = apAncho-1;
yN = apAlto-1;
xmin = -10.0;
xmax = 10.0;
ymin = -5.0;
ymax = 5.0;
}

public void paint( Graphics g ) {
double x1,y1,x2,y2;
int j1,j2;
j1 = ValorY( 0 );
for( int i=0; i < apAncho; i++ )
{
j2 = ValorY( i+0.5 );
g.drawLine( i,j1,i+0.5,j2 );
j1 = j2;
}
}
private int ValorY( int valor ) {
double x,y;
int retorno;
x = (valor * (xmax-xmin) / (apAncho-1)) + xmin;
y = x^2+4x+5;
retorno = (int)( (y-ymin) * (apAlto-5) / (ymax-ymin) );
retorno = apAlto - retorno;
return( retorno );
}
}

-------------------------------------------------

//Para dibujar la función cuadrática:

dibcuad.java

import java.awt.*;
import java.applet.Applet;

public class dibcuad extends Applet {
int x0,xN,y0,yN;

public void init() {
Dimension d = size();

x0 = y0 = 0;
xN = d.width-5;
yN = d.height-5;
}

public void paint( Graphics g ) {
for( int x=x0; x < xN; x++ )
g.drawLine( x,(int)(yN*X^2+4X+5),
x+1,(int)(yN*Math.(X^2+4X+5)) );
} }

------------------------------------------------

GraExp.java
//para la función exponencial se debe crear GrafExp.java

import java.awt.*;

import java.applet.Applet;

public class GraficoExp extends Applet {

int x0,xN,y0,yN;

double xmin,xmax,ymin,ymax;

int apAncho,apAlto;

public void init()

{

Dimension d = size();

apAncho = d.width;

apAlto = d.height;

x0 = y0 = 0;

xN = apAncho-1;

yN = apAlto-1;

xmin = -5.0;

xmax = 5.0;

ymin = -5.0;

ymax = 5.0;

}

public void paint( Graphics g ) {

double x1,y1,x2,y2;

int j1,j2;

j1 = ValorY( 0 );

for( int i=0; i <>

{

j2 = ValorY( i+0.5 );

g.drawLine( i,j1,i+0.5,j2 );

j1 = j2;

}

}

private int ValorY( int valor ) {

double x,y;

int retorno;

x = (valor * (xmax-xmin) / (apAncho-1)) + xmin;

y = 5*exp(x)+3x+2

retorno = (int)( (y-ymin) * (apAlto-5) / (ymax-ymin) );

retorno = apAlto - retorno; return( retorno );

}

}

//Para dibujar la función exponencial creamos " dibuja esponencial" dibexp.java

Gibexp.java
import java.awt.*;

import java.applet.Applet;

public class dibcuad extends Applet {

int x0,xN,y0,yN;

public void init() {

Dimension d = size();

x0 = y0 = 0;

xN = d.width-5;

yN = d.height-5;

}

public void paint( Graphics g ) {

for( int x=x0; x <>

g.drawLine( x,(int)(yN* 5*exp(x)+3x+2,

x+1,(int)(yN*Math.( 5*exp(x)+3x+2) );

}

}

No hay comentarios: