So in this tutorial I don't explain TurtleGraphics too much, but here is a text explanation. So the pen object in the code is like a real pen on paper. The pen.up() command picks the pen up from the paper so that it's not drawing. The pen by default starts out in the middle of the paper, so we move it to the corner by the following code until the pen.down() command. This command puts the pen on paper and allows the pen to draw. The rest of the code is explained in the video, but if you have any questions, feel free to ask.
download at:
http://turing.cs.wwu.edu/martin/Software%20Packages/TurtleGraphics/TurtleGraphics.zip
Source code:
import TurtleGraphics.StandardPen;
public class DrawSquare{
public static void main(String[] args){
StandardPen pen = new StandardPen();
/* Lifts the pen, and moves it to top of square */
pen.up();
pen.move(25);
pen.turn(90);
pen.move(25);
pen.down();
// Draws square
pen.turn(90); pen.move(50);
pen.turn(90); pen.move(50);
pen.turn(90); pen.move(50);
pen.turn(90); pen.move(50);
}
}
eez Java Vids
Search This Blog
Friday, January 21, 2011
Temperature Converter
In this tutorial, we'll make a Temperature converter that converts the temperature from Fahrenheit to Celsius. Once you go through this tutorial, try to make a converter that goes from Celsius to Fahrenheit. Leave a video of it in the comments, or just the source code.
Here is the tutorial:
Source code:
import TerminalIO.KeyboardReader;
public class Convert{
public static void main(String[] args){
KeyboardReader reader = new KeyboardReader();
double fahrenheit;
double celsius;
fahrenheit = reader.readDouble("Enter the temperature in Farenheit: ");
celsius = (fahrenheit - 32.0) * 5.0 / 9.0;
System.out.println("The equivalent in Celsius is: " + celsius);
}
}
Here is the tutorial:
Source code:
import TerminalIO.KeyboardReader;
public class Convert{
public static void main(String[] args){
KeyboardReader reader = new KeyboardReader();
double fahrenheit;
double celsius;
fahrenheit = reader.readDouble("Enter the temperature in Farenheit: ");
celsius = (fahrenheit - 32.0) * 5.0 / 9.0;
System.out.println("The equivalent in Celsius is: " + celsius);
}
}
Hello World
This is going to be our first program. Down below is the video:
Enjoy the vid.
Video link: http://www.youtube.com/watch?v=3f3ijwgJDbk
Source code:
public class HelloWorld {
public static void main(String[] args){
//code goes here
System.out.println(" d ");
System.out.println(" o l ");
System.out.println(" l r ");
System.out.println(" l o ");
System.out.println(" e W ");
System.out.println(" H ");
System.out.println(" xxxxxxxxxxxxxxxxx ");
System.out.println(" x x x ");
System.out.println(" x Java x x ");
System.out.println(" x xxxx ");
System.out.println(" x is hot! x ");
System.out.println(" x x ");
System.out.println(" xxxxxxxxxxxxxx ");
}
}
Enjoy the vid.
Video link: http://www.youtube.com/watch?v=3f3ijwgJDbk
Source code:
public class HelloWorld {
public static void main(String[] args){
//code goes here
System.out.println(" d ");
System.out.println(" o l ");
System.out.println(" l r ");
System.out.println(" l o ");
System.out.println(" e W ");
System.out.println(" H ");
System.out.println(" xxxxxxxxxxxxxxxxx ");
System.out.println(" x x x ");
System.out.println(" x Java x x ");
System.out.println(" x xxxx ");
System.out.println(" x is hot! x ");
System.out.println(" x x ");
System.out.println(" xxxxxxxxxxxxxx ");
}
}
Getting Set Up
Hey everyone! My first Java tut is finally up. I hope to go through this book that I got, and wanted to make a video of all the programs in it. This first video is for downloading and installing everything so we're all set to program.
Link to video:
http://www.youtube.com/watch?v=kYlHGjODAfc
Here are all the links:
http://www.oracle.com/technetwork/jav...
http://www.bluej.org/download/downloa...
http://faculty.cs.wwu.edu/martin/Soft...
source code:
public class Main{
public static void main(String[] args) {
System.out.println("test");
}
}
Link to video:
http://www.youtube.com/watch?v=kYlHGjODAfc
Here are all the links:
http://www.oracle.com/technetwork/jav...
http://www.bluej.org/download/downloa...
http://faculty.cs.wwu.edu/martin/Soft...
source code:
public class Main{
public static void main(String[] args) {
System.out.println("test");
}
}
Subscribe to:
Posts (Atom)