Created
May 1, 2018 17:18
-
-
Save ayyucedemirbas/be62eb10ba6b7c2c7b67ae6b0b07ab71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.applet.*; | |
| import java.awt.*; | |
| public class cos extends Applet{ | |
| // author @ayyuce | |
| // This program draws cos line | |
| public void paint(Graphics g){ | |
| g.setColor(Color.BLUE); | |
| g.drawLine(50, 300, 750, 300); | |
| g.drawLine(400, 50, 400, 550); | |
| g.drawLine(750, 300, 725, 325); | |
| g.drawLine(750, 300, 725, 275); | |
| g.drawLine(400, 50, 425, 75); | |
| g.drawLine(400, 50, 375, 75); | |
| g.drawString("x",750,250); | |
| g.drawString("y", 425,25); | |
| g.setColor(Color.RED); | |
| double x; | |
| for(x=0.0;x<=4*3.14;x+=0.01){ | |
| g.drawLine(400+(int)(10*x), 300-(int)(10*3*Math.cos(2.0*x)), 400+(int)(10*(x+0.01)), 300-(int)(10*3*Math.cos(2.0*(x+0.01)))); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment