Lucky Cat Tutoring Services

CIT 111 Java 101 week 2
August 25, 2009, 4:36 pm
Filed under: Class Notes, Java | Tags: , , ,

Time for more notes from D Smith’s CIT 111 class at CCAC.

A quick review:
–Classs can stack
–You can only have 1 main class
–You can have as many “Methods” in your class as you want
–All you need to get a program to run at all is a basic skeleton:

/*This is where comments go
public class nameOfProgram
        public static void main(String[] args)



Lets make a little program to draw a star pattern using last week’s lesson:

public class StarProgram
 { public static void main(String []args)
   System.out.println(”    *    “);
   System.out.println(“*       *”);
   System.out.println(”    *   “);
   System.out.println(”    *    “);
   System.out.println(”   ***   “);
   System.out.println(”  *****  “);
   System.out.println(” ******* “);
   System.out.println(”  *****  “);
   System.out.println(”   ***   “);
   System.out.println(”    *    “);
 } // ends the class and program

This displays a little star pattern like old school “Hi I’m drawing with emoticons” postings from the dark ages of the internet.  Don’t like how it looks? No need to delete a line of code:

Just turn whatever line that bothers you into a comment by dropping a “//” in front; great for debugging.


Learning about initializing variables

–if you plan to use a variable you need to declare it

–Variable can just be declared: ex int hours
–Assign set amount: ex int hours = 40;

int (INTEGERS) ex 7, 27, whole numbers
—Byte: 1 byte of memory
—Short: 2 bytes
—Long: 8 bytes. All LONGS must have the suffix “L” at the end or it will be output as an integer and not a long
double (FLOATING POINT) ex 7.1, 27.3 decimals
public class IntegerVariables
public static void main(String[] args)
int checking; // Declare an int variable named checking.
byte miles; // Declare a byte variable named miles.
short minutes; // Declare a short variable named minutes.
long days; // Declare a long variable named days.

//assignments to the data types, not redeclared
checking = -20;
miles = 105;
minutes = 120;
days = 185000L; //make sure it stays long
// int years = days / 365; mixed data types don’t work
int years = (int)days / 365; //years must be long; can’t fit 8 bytes of stuff in 4 byte box. Use explicite casting
Continue reading


August 20, 2009, 7:58 pm
Filed under: Uncategorized

On this blog I will post tutorials that I”ve written and links to ones that I”ve found that I enjoy. Notes from my Software Development courses will be posted here as well as long with other things I find useful for the maths, sciences, arts, and technology. I do private tutoring in everything from Photoshop, or 3d, to biology, Microbio, and anatomy for people in the Pittsburgh area.

CMU and Finch Robot
August 20, 2009, 4:28 pm
Filed under: Class Notes, Finches | Tags: , , ,

Tom Laurs, the lead researcher for CMU’s robotics institute came to visit class this week. He develops learning robots for computer science education at the newbie level and we’re one of the lab rat groups. Frankly a little robot like that is more “Friendly” to learn with than say a mountain of code. Without sounding too girly, it makes programming seem not so hard or scary when you’re telling a robot to move vs being confronted with “Write a program to mimic photoshop” or some nonsense like that.

Finch robot has a beak that can be programmed to be in any color like the Mathmo Aduki. It can see shapes and lights and can thus follow a person if told to. It can sense temperature to a point and it can move around on the floor on its leash. The Finch can tell how it’s held (upside down, on its side, etc) using an accelerometer from the Wiimote. It can also “speak” through computer speakers.

As we work with the finches I’ll post more on this posting. It’s cute for a tiny robot on a USB cable. Here’s the website of one of the guys who’ programmed it and a pic of it.
Erik Pasternak’s Page

It's probably sleeping because the nose light isn't on, and of course not plugged in

It's probably sleeping because the nose light isn't on, and of course not plugged in

Java programming 101 week 1
August 20, 2009, 4:19 pm
Filed under: Class Notes | Tags: , ,

I’m going to post all my notes for CIT 111 up here on the learning blog for those who either can’t take notes, didn’t, or like me in normal class can’t read them. Lets start with week 1 in Java Programming with D. Smith at CCAC

Basic programs for Java: jdk-6u2-windows-i586-p (library of java classes), jcreate400.
Resource Sites:
– Site for java Developers download resources for Java SE Java Tutorials home

I: Intro to Java
–All classes needed to program can be found in the Java Platform documentation, found in the links to the right.

I2: Starting with J Creator LE
–The program may look familiar as it’s built like the average windows program.

  1. Go to NEW>FILE>Empty java file
  2. When naming your file, the FILE NAME should be the same name as the CLASS NAME
  3. FILE NAME must ALWAYS begin with an uppercase letter: EX (
  4. CONFIGURE>JAVA>Show line numbers


  1. Every time you write a program, you need to have comments. Comments keep things organized, remind what parts of code do,
  2. // = comment start (will show up green)
  3. /* =block comment. Lets you write a whole paragraph of coments without having to do // for every line
  4. {} = Determines where a class begins and ends like < > in HTML. Everything that is in the class (EX: public class LuckyCat)

EX so far:


/*  LuckyCat
 *  CIT 111 AC02
 *  08-20-09
 *  This is an in class toy
 public class LuckyCat //class declaration
           public static void main(String [] args) //method declaration

 }// ends class

Continue reading