Monday, September 30, 2013

Trick the Turtle: Adding Sound

Today we will be playing with adding sound to our program.

Video #11:  Adding Sound


Some sources of WAV or MP3 sound files:
A tool that you can get to play with sounds is called BP Minus (which was written by Jacob Johnson, a former student).  You can download the software here (http://bpminus.com/) for your home computers, but we already have it installed on our systems.

Spend today adding sounds to your program.

Friday, September 27, 2013

Trick the Turtle: Adding Control

Today we will be adding keyboard control to our programs so we can "drive" the turtle around, and then we will be changing the graphics to customize our programs.

Video #10: http://www.youtube.com/watch?v=1nbpdro6gP4 (Add Keyboard Control)
Video #11: http://www.youtube.com/watch?v=GXO3V5-lbzk (Customize Graphics)

Updated Code: http://www.greenfoot.org/static/joc/material/trick-the-turtle-v3.zip
(This code includes the snakes and some keyboard control)

Thursday, September 26, 2013

Trick the Turtle: Cleaning Up the Code and Adding Bad Guys

Continue with Trick the Turtle

A fresh copy of the Trick the Turtle Source Code:
http://www.greenfoot.org/static/joc/material/trick-the-turtle-v2.zip

Video #8: http://youtu.be/Ep6Z7oxM7V8 (Cleaning Up Code)
Video #9: http://youtu.be/prpvOqWOo7M (Adding "Bad Guys")

Wednesday, September 25, 2013

Coding with Greenfoot: Trick the Turtle (Continued)

Today we will watch and follow the video series:

We will be building in random movement and then adding a food source for our turtle.

Tuesday, September 24, 2013

Coding with Greenfoot: Trick the Turtle

We will view [and work through] two parts of the series today:


You can download the source for this project here:


In this session Mik will be discussing:
  • method call
  • method definition
  • parameter
Please follow along with him using the source code.  This will be the foundation for our first "graphic game".

Monday, September 23, 2013

Beginning Greenfoot: Objects and Classes

Today we will begin a series of videos by Michael Koelling -- a programmer, instructor and developer of the Greenfoot JAVA IDE.  His blog can be found here: http://blogs.kent.ac.uk/mik/category/joy-of-code/page/2/

We will be working with the following "Scenario": http://www.greenfoot.org/static/joc/material/hedgehogs.zip

Some of the topics Mik will cover in this video include (and please take notes on this):
  • class
  • object
  • method
  • instance
  • return value
  • return type
  • void
  • int
  • boolean
Some of these concepts may already be familiar to you, but they are crucial to fully understand JAVA.

Video #3 of the series: http://youtu.be/tZNnYeqm5BU

Friday, September 20, 2013

Case Study: Rock, Paper, Scissors

I want to look at the following code before you begin building your own.  Copy the code below to a new Class (RockPaperScissors) and then "Auto Format" the code to see how that works.

This is a VERY different approach than what we've been doing so far.  They use a few codes we haven't seen before (i.e. boolean, String, while, nextLine, toLowerCase, ||, concat, etc.).  What are they doing?  What is "broken" in the code below?

Rock, Paper, Scissors:

import java.util.Scanner;
public class RockPaperScissors {
public static void main(String[] args) {
CPU cpu1 = new CPU();
Scanner sc1 = new Scanner(System.in);
boolean validmove = false;
String userMove = "";
while(!validmove){
System.out.println("Input your move (rock, paper or scissors): ");
userMove = sc1.nextLine();
userMove = userMove.toLowerCase();
if(userMove.equals("rock") || userMove.equals("paper")||userMove.equals("scissors")){
validmove = true;
}
}
String CPUMove = cpu1.getCPUMove();
cpu1.comparemoves(CPUMove, userMove);
}
}
class CPU{
public void comparemoves(String CPUMove, String userMove){
if(userMove.equals("rock")){
if(CPUMove.equals("rock")){
outputmoves("rock", "Tie!");
}
if(CPUMove.equals("paper")){
outputmoves("paper", "I win!");
}
if(CPUMove.equals("scissors")){
outputmoves("scissors", "You win!");
}
}
if(userMove.equals("paper")){
if(CPUMove.equals("rock")){
outputmoves("rock", "You win!");
}
if(CPUMove.equals("paper")){
outputmoves("paper", "Tie!");
}
if(CPUMove.equals("scissors")){
outputmoves("scissors", "I win!");
}
}
if(userMove.equals("scissors")){
if(CPUMove.equals("rock")){
outputmoves("rock", "I win!");
}
if(CPUMove.equals("paper")){
outputmoves("paper", "You win!");
}
if(CPUMove.equals("Scissors")){
outputmoves("scissors", "Tie!");
}
}
}
public void outputmoves(String cpuout, String status){
String output = "I played ".concat(cpuout).concat(".").concat(status);
System.out.println(output);
}
public String getCPUMove(){
int choice = (int) Math.floor(Math.random()*3);
String rpsmove = "";
switch(choice){
case 0: rpsmove = "rock"; break;
case 1: rpsmove = "paper"; break;
default: rpsmove = "scissors"; break;
}
return rpsmove;
}
}

Thursday, September 19, 2013

Case Study: Using Strings (Haiku)

Obviously I am out again today, so I am having to change it up a little bit.  Here's another program that I want you to play with.  This one uses strings and an interesting approach to formatting.  I commented some of the code to help you figure it out.

We're building a program that will generate Haiku poetry based on user input.  A haiku is a poem in 3 lines -- a line of 5 syllables, a line of 7 syllables, and a line of 5 syllables again.

Some examples of Haiku:
Falling to the ground,
I watch a leaf settle down
In a bed of brown.

It’s cold—and I wait
For someone to shelter me
And take me from here.
Snow falling slowly
Blanketing the trees and road
Silence and beauty.

Haiku Program:

//Mad Libs Haiku

import java.util.Scanner;

public class Haiku
{
   public static void main( String[] args )
   {
   //create Scanner to get input from user
      Scanner input = new Scanner( System.in );

      String word1;//Person's name, 2 syllables
      String word2;//Noun, 2 syllables
      String word3;//Adjective, 1 syllable
      String word4;//Adjective, 1 syllables
      String word5;//Adjective, 2 syllables

      System.out.print( "Type a person's name -- two syllables: " );//prompt
      word1 = input.nextLine();//read user input

      System.out.print( "Type a two-syllable noun: " );//prompt
      word2 = input.nextLine();//read user input

      System.out.print( "Type a one-syllable adjective: " );//prompt
      word3 = input.nextLine();//read user input

      System.out.print( "Gimme another one-syllable adjective: " );//prompt
      word4 = input.nextLine();//read user input

      System.out.print( "Last one! A two-syllable adjective: " );//prompt
      word5 = input.nextLine();//read user input


      System.out.println( "\n\nHere is your Mad Libs-style haiku:\n\n" );
      System.out.printf( "I said to %s,\n", word1 );
      System.out.printf( "\"My love is like a %s:\n", word2 );
      System.out.printf( "%s, %s, and %s.\"\n", word3, word4, word5 );

   }//end method main
}//end class Haiku

Wednesday, September 18, 2013

Looking at Code: Alphabet Formatting

Hi Guys!  So obviously I'm out sick today.  Instead of starting on the Rock, Paper, Scissors code today, I want you to do two things:

1.) Finish up your Fewest Coins Possible code
2.) Explore and experiment with the code below.  What is it doing?  How does it work?  Can you change it?

This is an interesting use of formatting and a "for loop" as well as the ++ option to count up. Let's look at how it works:

public class Alphabet
{
public static void main(String [] args)
{
    char current = 'A';
    for(int row = 1; row <= 3; row++)
    {
        for(int column = 1; column <= 10; column++)
        {
            System.out.print(current + " ");
            current++;
        }
    System.out.println();
}
}
}

Tuesday, September 17, 2013

Homework: Flow Chart & Begin Code for Rock, Paper, Scissors

Tomorrow we will begin coding a "Rock, Paper, Scissors" game. Create a flow chart demonstrating how a user will choose either rock, paper or scissors, and then the computer will make a choice.

If you aren't familiar with the game, two players will count to three and then throw out their hands with either a rock, a paper, or a scissor.

  • Rock beats Scissors
  • Scissors beats Paper
  • Paper beats Rock
You may want to think about counting points so you could play "best of 10" or even until someone enters "quit".

Monday, September 16, 2013

My Flow Chart: Minimum Coins Challenge

A question I had on Friday was, "Why would we ever need a program to tell us how many coins to give someone when we know how to easily count coins?"  It's a fair question and I will answer it after a brief description:

When I was a kid a cashier would ring up all of the items at the grocery store, people would pay the cashier (in cash), and the cashier would give currency (paper bills) to the customer.  While the cashier was counting the currency out, coins would automatically drop into a little tray in front of the customer.  Those coins were the minimum number of coins needed to avoid unnecessary trips to the bank for extra coins.  Today we don't use cash very often, so those little trays take up valuable counter space -- a space which today is typically filled with a credit/debit card reader.

However, most vending machines are still based on cash purchases [although many are slowly moving to credit/debit cards].  We typically associate vending machines with candy, snacks, and drinks.  We may put in $2.00 and buy a bottle of water for $1.25 and the machine kicks out three quarters in change.  We put in another dollar and buy a bag of chips for 80 cents and the machine kicks out 2 dimes.  You may be in a hospital waiting room and see a food machine that has sandwiches, burritos, etc.  You put in $2.00 for a $1.60 burrito and you get back a quarter, a dime and a nickel.  In some areas [amusement parks, for example] you can buy things like cameras, batteries, SD cards, t-shirts, and more.  That is all programming and [again] it's designed to kick back the minimum number of coins [or bills] for change.  When a particular coin is empty [i.e. there are no more quarters] the machine will stop accepting new money -- which means the owner of the machine will stop making money.  You COULD build in an algorithm that would say, "Uh oh... we're out of quarters.  Give two dimes and a nickel instead."  It's all up to the programmers.

Here's an example of a flow chart I made with a free online chart creator called "LucidChart".

I added process to remind me to import the Scanner (to get input) and to declare my variables.

Next I displayed (output) the Title and Instructions (asking for input in cents... 1 to 99).

Then I checked to make sure the input was in cents by less than one (i.e. .85) or greater than one dollar [100] (i.e. 154).

I added another check as an example to see if it was more than 1 but less than 2 (i.e. 1.54), although that won't happen because we will be declaring "amount" as an integer.

Next I calculate how many quarters are in the amount by dividing amount by 25.  I set the variable "quarters" to that number.

Then I figure out the remainder (the change left after quarters) by setting the new amount to amount - (quarters * 25).

I repeat these last two steps until I end up at pennies; at which time the left over amount will be less than 5 cents so whatever is left over will be in pennies.

Finally I display the coins.  Note that you COULD set up a routine that only displays a coin if there are coins in that category.  For example: "If quarters > 1 go ahead and display the quarter row."

I ended with a Stop, but we could easily have looped it back to the top to start over.

Work today to build this code, create a title graphic, and enhance your code in some way.  When you have finished, sign up for an account at Lucidchart.

Friday, September 13, 2013

Flow Chart & Code Homework

Here's another challenge that might be fun to try -- and will help keep you "code-limber".  :)

Fewest Coins Possible:  The idea for this project is that we ask the user for the amount of change they have (let's assume it's $1 or less) and we figure out the fewest number of coins needed to total that amount.  Now if you remember from the "Equally Divide" project we calculated a remainder as "Left Over" -- and this is similar to that.  We will calculate the number of quarters needed, get the remainder, divide that by the number of dimes, etc.

  • Set up variables for each coin type: Quarters, Dimes, Nickels, and Pennies
  • Set up a variable for the currentCents
  • Ask users to enter the amount of cents ($1 would be 100, for example)
  • Calculate Quarters first, then find the remainder and set currentCents to the remainder amount
  • Calculate Dimes from the remainder (again currentCents)
  • Continue with Nickels and Pennies
  • Display the results like, "Quarters: xx"
  • Amounts to try:  91, 41, 59, 6 (and obviously others)
This program is definitely possible for you to complete knowing what you already know.

Thursday, September 12, 2013

Some Interesting Video Clips


ASCII Text Generator

A request has been made for an ASCII Text Generator.  :)

http://patorjk.com/software/taag/#p=display&f=Doh&t=Griff

Flow Chart and Code: Coin Toss


I would like for you to create the following:

Part 1: Random Coin Toss
  • Create a Class called CoinToss
  • Add appropriate comments, titles and attributions
  • Display a title "text graphic" when the program is executed
  • Generate a random number (using either of the methods that I showed you)
  • Display whether the result was a Heads or a Tails
 Part 2: Count Results
  • Loop for 1000 "flips"
  • Count the number of Heads
  • Count the number of Tails
  • Display the total number of Heads and Tails
 Part 3: Coin Toss Guess
  • Ask the user if they want heads or tails (maybe a 1 or a 2) right now
  • Randomly select Heads or Tails
  • Tell the user whether they win or lose
  • Optional: Count wins & losses and loop until user quits (i.e. enters a 0)
This is an example code using some techniques you haven't learned yet.  I am sharing this so you can see how simple you can make the code.  Also notice that I added comments to the end } tags.  This helps me remember where things should be.

//import statements
import java.util.*;
 
public class FlipCoin
{
    public static void main(String [] args)
    {
        //declare variables
       double flip;
        int count = 0;
        int countHeads = 0;
        int countTails = 0;         
         
        //Loop
        for(int x = 0; x <= 10;x = x++)
        {
            x = x + 1;
           //flip
           flip = Math.random();
            //if statement
           if( flip <= .5)
            {  
                flip = countHeads;
                countHeads = countHeads + 1;
                }
            else
            {          
                flip = countTails;
              countTails = countTails + 1;            
            }
            
            count = count +1;             
                     
        }//End Loop         
         
}//End Main
}//End Class

For Loops

class ForDemo {
public static void main(String args[]) {
int count;

for(count = 1; count < 25; count = count+1)
System.out.println("This is count: " + count);
System.out.println("Done!");
}
}


//Reverse Order
class ForDemo {
public static void main(String args[]) {
int count;

for(count = 99; count > 0; count = count-1)
System.out.println("This is count: " + count);
System.out.println("Done!");
}
}

Wednesday, September 11, 2013

Number Guessing Game: Revisited

Today we made some changes to the Number Guessing Game:

// ======================
//  Number Guessing Game
//      Version 1.1
//   By Robert Griffith
// ======================
import java.util.Scanner;
  public class NumberGuessingGame2 {
        public static void main(String[] args)
        {
            int secretNumber;
            int guess;
            int tries;
            int maxtries;
           
            secretNumber = (int) (Math.random() * 999 + 1);
            //System.out.println("Secret number is " + secretNumber); // to be removed later
            Scanner keyboard = new Scanner(System.in);
            tries=0;
            maxtries=10;
                             
            do {
                tries=tries+1;
                System.out.print("Enter guess #" + tries + ": ");
                guess = keyboard.nextInt();
                System.out.println("Your guess is " + guess);
                if(tries > maxtries)
                   {
                   System.out.println("You have exceeded the maximum number of tries.  The secret number was " + secretNumber + ". Sorry!");
                   System.exit(0);
                   }
                if(guess == secretNumber)
                   {
                   System.out.println("Your guess is correct! It took you " + tries + " tries.  Congratulations!");
                   }
                if (guess < secretNumber)
                   {
                   System.out.println("Your guess is smaller than the secret number.");
                   }
                if (guess > secretNumber)
                   {
                   System.out.println("Your guess is larger than the secret number.");
                   }
            } while (guess != secretNumber);
        }
  }

Tuesday, September 10, 2013

JAVA Case Study #4: Number Guessing Game

This case study involves a random number generator -- but in this case we will be using a "Math" method for the random number.  We will work through it in steps:

CASE STUDY #4:  A Number Guessing Game -- Building a Program Step By Step

Step One: Let's try a different method for finding a random number -- this time from 1 to 1000.

import java.util.Scanner;

public class NumberGuessingGame {
    public static void main(String[] args)
    {
        int secretNumber;
        secretNumber = (int) (Math.random() * 999 + 1);
        System.out.println("Secret number is " + secretNumber); // to be removed later
        Scanner keyboard = new Scanner(System.in);
        int guess;
              
        do {
            System.out.print("Enter a guess: ");
            guess = keyboard.nextInt();
            System.out.println("Your guess is " + guess);
            if(guess == secretNumber)
                        {
                            System.out.println("Your guess is correct! Congratulations!");
                        }
            if (guess < secretNumber)
                        {
                            System.out.println("Your guess is smaller than the secret number.");
                        }
            if (guess > secretNumber)
                        {
                            System.out.println("Your guess is larger than the secret number.");
                        }
        } while (guess != secretNumber);
    }
}
Suggestions for Continuing to Upgrade Your Code
  • Add comments and labels [obviously]
  • Create a little title text graphic to display at the beginning of your program.
  • Display "Guess #" in front of [or behind] each "Enter a guess" prompt.
  • Limit the number of guesses a user gets -- and you might even have it display something like "Guess 3 of 10".

Monday, September 9, 2013

JAVA Case Study #3: Magic Cue Ball

For this case study, we will need to have a random number generator -- simply put, a way to randomly pick a "No" or a "Yes" (a 0 or a 1).  Here's a sample code which generates a random number:
import java.util.Random;
class RandomNumber {
    public static void main(String args[]) {
        Random myRandom = new Random();
        int randomNumber;
        randomNumber = myRandom.nextInt(10) + 1;
        System.out.println(randomNumber);
       }

CASE STUDY #3:  Magic Cue Ball

For case number 3 we have "The Magic CueBall" -- okay, so it's ripped off... but it works... sort of:
import java.util.Scanner;
import java.util.Random;

class MagicCueBall {

    public static void main(String args[]) {
        Scanner myScanner = new Scanner(System.in);
        Random myRandom = new Random();
        int randomNumber;
        System.out.print("Type a Yes or No question: ");
        myScanner.nextLine();
        randomNumber = myRandom.nextInt(10) + 1;
        if (randomNumber > 5) {
            System.out.println("Yes. Isn’t it obvious?");
        } else {
            System.out.println("No, and don’t ask again.");
        }
    }
}
 
Let's do some playing with the code again:
  • Again, begin by adding comments/labels to the code.
  • What Java utils are we bringing in this time?
  • Before the "if" statement, randomNumber can be what possible numbers?  Why is there a +1 at the end of the line?
  • Add some variation to the possible responses:
    • 4 different "Yes" answers
    • 4 different "No" answers
    • 2 different "Ask Again" answers
  •  At the beginning of the program (before asking the user to type a yes or no question), add a title text graphic.  For example:
    • *********************************
    • * Magic Cue Ball 1.0 ~ by Your Name  *
    • *********************************
  •  What else could we add to make this application more usable?

Friday, September 6, 2013

JAVA Case Study #1: Movie Tickets

 CASE STUDY #1:  Movie Tickets

Let's look at this code for a movie ticket program:
import java.util.Scanner;
class TicketPrice {
public static void main(String args[]) {
Scanner myScanner = new Scanner(System.in);
int age;
double price = 0.00;
System.out.print("How old are you? ");
age = myScanner.nextInt();
if (age >= 12 && age < 65) {
price = 9.25;
}
if (age < 12 || age >= 65) {
price = 5.25;
}
System.out.print("Please pay $");
System.out.print(price);
System.out.print(". ");
System.out.println("Enjoy the show!");
}
}
 
  • First of all, what is the name of this Class?
  • What are we bringing into the Class from Java that is already built for us?
  • What does "Scanner" do?
  • What does "double" mean in Java?
  • What variables are we using in this code?
  • What could you substitute for, "if (age <12 | | age >= 65)  {"
  • What are some of the things that are missing in this code?
  • What would the ticket price be for an 8 year old?  A 14 year old?  A 66 year old?
  • Draw a flow chart indicating the flow of this program.
Next, let's update the source code:
  • Begin by formatting the source code to be more readable -- add line breaks, indent (Tab) some of the lines, etc.  (See the next case study for an idea of how to format it)
  • Add some comments to the code.  Remember that every Class needs a title, author(s), and version (number or dates) and maybe some comments describing what a formula or function does.

JAVA Case Study #2: Divide Items Equally

CASE STUDY #2: Divide Items Equally

Next let's look at this strange code for a program that will divide the total number of gumballs equally among a varied number of children:
import java.util.Scanner;

class EquallyDivide
{

    public static void main(String args[]) {
        Scanner myScanner = new Scanner(System.in);
        int gumballs;
        int kids;
        int gumballsPerKid;

        System.out.print("How many gumballs? ");

        gumballs = myScanner.nextInt();
        System.out.print("How many kids? ");

        kids = myScanner.nextInt();
        gumballsPerKid = gumballs / kids;

        System.out.print("Each kid gets ");
        System.out.print(gumballsPerKid);
        System.out.println(" gumballs.");
    }
}
 
So let's work with this code:
  • Add some comments / labels.
  • What is the difference between:
    •  System.out.println
    •  System.out.print
  • With variable names like "gumballs" or "kids" or "gumballsPerKid", this program is pretty specific.  What sorts of names could we use for variables to make this program usable for other purposes?  The "gumballs" variable might be more useful as "items", for example.  Remember, however, that you can change all instances of "gumballs" but "gumballsPerKid" is a completely different variable name.
  • What code could we add to figure out how many gumballs are left over after they have been divided equally?

Thursday, September 5, 2013

Looking at Source Code & Flow Charts

Today we will be playing with some existing source code.  We will discuss what the programs do, how they are outlined, and what we can do to improve them.  Then we will attempt to expand on the programs

Below is a snippet of code that we will be entering in:

public class HelloWorld
{
   public static void main(String[] args)
   {
      System.out.println("Hello World!");
   }
}
 

Programming is about solving problems.  The entire purpose of writing a program is to solve a problem which, in general, consists of multiple steps:
  1. Understanding the problem.
  2. Breaking the problem into manageable pieces.
  3. Designing a solution.
  4. Considering alternatives to the solution and refining the solution.
  5. Implementing the solution.
  6. Testing the solution and fixing any problems.
After we understand a given problem, we can break the problem into manageable pieces and design a solution.  For example, if we wanted a program to figure out the least possible number of coins to give a customer as change, we might want to first subtract the amount owed from the amount paid, then figure out how many quarters would go into that, take the remainder and figure out how many dimes would go into that, and then move on to nickels and then pennies.  For more complex problems, making a flow chart can help to organize your thoughts and identify potential issues before you begin programming.

Below are some potential "problems" for you to solve using flow charts.

Flow Chart Practice: 
  1. A movie theater wants a program that will show admission price based on age.  They want to charge children (under 12) and seniors (65 and older) $5.25.  Everybody else will pay $9.25.  They want to ask "How old are you?", let the person put in their age (in years), tell them the price, then tell them to "Enjoy the show!".
  2. A daycare provider wants to give gumballs to their kids, but they want a program that will ask the worker, "How many gumballs?" and then "How many kids?".  Then it should divide the gumballs per kid (gumballs/kids).  Finally it should say, "Each kid gets X gumballs."
  3. You decide to write an app for a SmartPhone.  You want to do a Magic 8 Ball app where you ask a question and it gives you a "Yes" or "No" answer.
  4. You want to write a program that will pick a random number between 1 and 1000.  Ask the player to guess a number and tell them if they are too high, too low, or if they get the number correct.  The program should keep running until they guess the number correctly.

Wednesday, September 4, 2013

About Programming

Why Is Computer Programming Important:


The Early Days of Programming

During the early 1980s, Chris worked for a computer software firm. The firm wrote code for word processing machines. (At the time, if you wanted to compose documents without a typewriter, you bought a “computer” that did nothing but word processing.) Chris complained about being asked to write the same old code over and over again. “First, I write a search-and-replace program. Then I write a spell checker. Then I write another search-and-replace program. Then, a different kind of spell checker. And then, a better search-and-replace.”

How did Chris manage to stay interested in his work? And how did Chris’s employer manage to stay in business? Every few months, Chris had to reinvent the wheel. Toss out the old search-and-replace program, and write a new program from scratch. That’s inefficient. What’s worse, it’s boring.

For years, computer professionals were seeking the Holy Grail — a way to write software so that it’s easy to reuse. Don’t write and rewrite your search-and replace code. Just break the task into tiny pieces. One piece searches for a single character, another piece looks for blank spaces, a third piece substitutes one letter for another. When you have all the pieces, just assemble these pieces to form a search-and-replace program. Later on, when you think of a new feature for your word processing software, you reassemble the pieces in a slightly different way. It’s sensible, it’s cost efficient, and it’s much more fun.

The late 1980s saw several advances in software development, and by the early 1990s, many large programming projects were being written from prefab components. Java came along in 1995, so it was natural for the language’s founders to create a library of reusable code. The library included about 250 programs, including code for dealing with disk files, code for creating windows, and code for passing information over the Internet. Since 1995, this library has grown to include more than 3,000 programs. This library is called the API — the Application Programming Interface.

Every Java program, even the simplest one, calls on code in the Java API.  This Java API is both useful and formidable. It’s useful because of all the things you can do with the API’s programs. It’s formidable because the API is so extensive. No one memorizes all the features made available by the Java API. Programmers remember the features that they use often, and look up the features that they need in a pinch. They look up these features in an online document called the API Specification (known affectionately to most Java programmers as the API documentation, or the Javadocs).

The API documentation describes the thousands of features in the Java API.  As a Java programmer, you consult this API documentation on a daily basis. You can bookmark the documentation at the Sun Microsystems Web site and revisit the site whenever you need to look up something. But in the long run (and in the not-so-long run), you can save time by downloading your own copy of the API docs.

Flow Charts

The first example is lengthy, but the first 6+ minutes are the part I want you to focus on -- unless of course you want to learn C++ programming.  The professor does a great job of demonstrating a basic problem that we need to solve, lays it out in steps, and then applies to steps to a flow chart.





This is a flow chart of making decisions in your life:
This is a useful tool for figuring out what to do:

Here's a funny flow chart in action:  http://www.youtube.com/watch?v=k0xgjUhEG3U
And lastly... this little gem. :)

Tuesday, September 3, 2013

AP Computer Science

CollegeBoard's Course Description for AP Computer Science A

The AP Computer Science A course is an introductory course in computer science. Because the design and implementation of computer programs to solve problems involve skills that are fundamental to the study of computer science, a large part of the course is built around the development of computer programs that correctly solve a given problem. These programs should be understandable, adaptable, and, when appropriate, reusable. At the same time, the design and implementation of computer programs is used as a context for introducing other important aspects of computer science, including the development and analysis of algorithms, the development and use of fundamental data structures, the study of standard algorithms and typical applications, and the use of logic and formal methods. In addition, the responsible use of these systems is an integral part of the course.

Because this is a brand new course, we don't have a full year outline yet.  However, you should be receiving a syllabus and general (tentative) outline sometime this week.
Welcome to Week One of "AP Computer Science"! Although this course is called "Introductory Computer Science", it is actually fairly complex. We will be building up to the core of an AP Computer Science course.
Your homework is to install the JAVA software [on your home computer] as follows:
  1. Install JDK on your home computer and/or laptop (wherever you plan to work on Java programming)
  2. Install the Java API (Docs)
  3. Install BlueJ on your computer/device.
  4. Install GreenFoot on your computer/device.
And now for a brief intro about the importance of updating your Java.
And demonstrating some of the JAVA epicness... hardcore.