Important alert: (current site time 5/22/2015 5:40:16 PM EDT) They're finally here! Check out our new 7 Source Code CDs!

# Simple zig-zag graph

Email
 Submitted on: 3/12/2012 5:12:37 PM By: Piush Kumar Level: Beginner User Rating: Unrated Compatibility: Java (JDK 1.2) Views: 1938

Simple zig-zag graph

code:
Can't Copy and Paste this?
 Terms of Agreement:    By using this code, you agree to the following terms...    You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.    You may link to this code from another website, but ONLY if it is not wrapped in a frame.  You will abide by any additional copyright restrictions which the author may have placed in the code or code's description. ``` //************************************** // Name: Simple zig-zag graph // Description:Simple zig-zag graph // By: Piush Kumar // //This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=7007&lngWId=2//for details.//************************************** import java.awt.Graphics; public class Graph extends java.applet.Applet { double f(double x) { return (Math.cos(x/5) + Math.sin(x/7) + 2) * getSize().height / 4; } public void paint(Graphics g) { for (int x = 0 ; x < getSize().width ; x++) { g.drawLine(x, (int)f(x), x + 1, (int)f(x + 1)); } } public String getAppletInfo() { return "Draws a sin graph."; } }```

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)