lunes, 25 de mayo de 2009

Evaluacion Sen,Cos,ax+b


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

public class Evaluacion1 extends Applet {
public void paint(Graphics g){
g.drawString("Función Seno, Funcion Coseno, Recta: ax+b", 150, 55);
g.drawString("y=MSen(ax+b)",300 , 80);
g.drawString("y=MCos(ax+b)",300 , 100);
g.drawString("y=(ax+b)",300 , 120);
g.drawLine(40, 40, 40, 450);
g.drawLine(20, 270, 450, 270);
g.setColor(Color.BLACK);

int a=1;
int b=0;
int m=100;
for(int i=0;i<361; i=i+2)
{
g.fillOval( a*(38 + i)+b,(int) (265 - m*(Math.sin(i*3.1416/180))),6,6);
g.fillOval( a*(38 + i)+b,(int) (265 - m*(Math.cos(i*3.1416/180))),6,6);
g.fillOval( a*(38 + i)+b,(int) 265-(a*i)+b,6,6);
}

g.setColor(Color.GREEN);
g.drawLine(40,165, 398, 165);
g.drawLine(40,370,398,370);
g.drawLine(131,165, 131, 370);
g.drawLine(221,165,221,370);
g.drawLine(311,165, 311, 370);
g.drawLine(401,165,401,370);
g.setColor(Color.BLUE);
g.drawString("-1", 30, 370);
g.drawString("0", 30,270);
g.drawString("1", 30, 165);
g.drawString("¶/2", 115, 280);
g.drawString("¶", 205,280);
g.drawString("3¶/2", 285, 280);
g.drawString("2¶", 405, 280);
g.drawLine(40,40,35,55);
g.drawLine(35,55,45,55);
g.drawLine(45,55,40,40);
g.drawLine(450,270,425,265);
g.drawLine(425,265,425,275);
g.drawLine(425,275,450,270);
g.setColor(Color.MAGENTA);
g.drawString("valores X ", 460, 270);
g.drawString("valores Y ", 25, 35);
int ymax=this.getHeight();
int xmax=this.getWidth();
this.setSize(700, 700);
} }

2 comentarios:

  1. El codigo es muy claro.. a su vez las funciones del seno y coseno se las entiende muy bien.. buen trabajo...

    ResponderEliminar
  2. Encuentro muy completo tu programa, me parece que podrías corregirle la linea de "niu" es friccion te corrijo. La tabla esta muy entendible, buen trabajo

    ResponderEliminar