Posts

Showing posts from September, 2013

Graphics Programming

I've been getting a few questions about Java graphics: "Do you know of any good graphics tutorials for java? I am working with one that might work, but any suggestions you have would be great." Below are some links that I found useful:   http://docs.oracle.com/javase/tutorial/2d/index.html http://www.corewebprogramming.com/PDF/ch10.pdf http://www.deitel.com/articles/java_tutorials/20050923/IntroductionToJava2D.html   Java has an advanced graphics 2D API . It is quite sophisticated and might be daunting for beginners who just want do something fun. I found that for casual programming, Processing is more approachable and you can write a fairly complex program with it. Also, one of the most popular Java client side graphics libraries is Android (of course, it's not really Java at runtime on the device).  

Young Coders: Week 4 Problems

The Final Challenges! 1) Create a method called between. Its parameter is an int array. It will return the maximum distance between any two equal values.  For example: between(new int[] {1,0,4,2,5,0,0,5}) should return 6, because the leftmost 0 and the rightmost 0 are 6 elements apart (including themselves). 

Young Coders: Week 4 Notes

Image
Sorting and Searching Bubble Sort, Insertion Sort, Selection Sort Linear Search, Binary Search How to swap two elements We first looked at how to swap two elements. Let's say we have  int a = 2; int b = 3; and we want to switch their values, so that a = 3 and b = 2.  Remember, we can't just say: a = b; b = a; As we saw on the whiteboard yesterday, this will make both a and b equal to 3, instead of switching their values: