<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-21717786</id><updated>2011-04-21T21:19:38.722-07:00</updated><title type='text'>java scratchpad</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-21717786.post-116613968174847668</id><published>2006-12-14T15:41:00.000-08:00</published><updated>2006-12-14T15:47:14.340-08:00</updated><title type='text'>finalMethodsReview.java</title><content type='html'>&lt;pre&gt;
public static int randomUpTo(int n) // generate random num up to n
{
 Random generator = new Random();
 return generator.nextInt(n);
}
public static int randomBetween(int first, int second) // inclusive
{
 Random generator = new Random();
 return generator.nextInt(second - first + 1) + first;
}
public static void printLettersOnSeparateLines(String s)
{
 for(int i = ; i &lt; s.length(); i++)
  System.out.println(s.charAt(i));
} 
public static boolean longerThanSecond(String first, String second)
{
 return first.length() &gt; second.length();
public static boolean comesBeforeSecond(String first, String second)
{
 return first.compareTo(second) &lt; 0;
}
public static int countVowels(String s)
{ 
 char ch;
 int count = 0;
 for(int i = ; i &lt; s.length(); i++)
  {
   ch = s.charAt(i);
   if(ch == 'a' || ch == 'e' || ch == 'i' || ch == '0' || ch == 'u')
    count++; 
  }
 return count;
}
public static String replaceLetterWithAsterisk(String s, char letter)
{
 for(int i = 0; i &lt; s.length(); i++)
  if(s.charAt(i) == letter) s.charAt(i) = '*';
 return s;
}
public static boolean isAdverb(String s) // check if s ends in "ly"
{
 String ending = new String();
 ending = s.substring(s.length() - 2);
 return ending.equals("ly");
}
public static void print(int[] list)
{
 for(int i = 0; i &lt; list.length; i++)
  System.out.println(list[i]);
}
public static void printBackwards(int[] list)
{
 for(int i = list.length - 1; i &gt;= 0; i--)
  System.out.println(list[i]);
}  
public static int sum(int[] list)
{
 int sum = 0;
 for(int i = 0; i &lt; list.length; i++)
  sum += list[i];
 return sum;
}
public static double average(double list[])
{
 double sum = 0;
 for(int i = 0; i &lt; list.length; i++)
  sum += list[i];
 return sum / list.length;
}
public static int countEvens(int[] list)
{
 int count = 0;
 for(int i = 0; i &lt; list.length; i++)
  if(list[i] % 2 == 0) count++;
 return count;
}
public static void reverse(int[] list)
{
 int[] newList = new int[list.length];
 int k = 0;
 for(int i = list.length - 1; i &gt;= 0; i--)
  newList[k++] = list[i];
 list = newList;
} 
public static void swapPairs(int [] list) // assume even sized list
{
 int temp;
 for(int i = 0; i &lt;= list.length - 2; i += 2)
  {
   temp = list[i];
   list[i] = list[i+1];
   list[i+1] = temp;
  }
}
public static boolean allValuesUnique(int[] list)
{
 for(int i = 0; i &lt; list.length; i++)
  for(int j = 0; j &lt; list.length; j++)
   if(list[i] == list[j] &amp;&amp; i != j) return false;
 return true;
}
public static void printTable(int[][] table)
{
 for(int row = 0; row &lt; table.length; row++)
  for(int col = 0; col &lt; table[row].length; row++)
   System.out.println(table[row][col]);
}
public static void printRow(int[][] table, int row)
{
 for(int col = 0; col &lt; table.length; col++)
   System.out.println(table[row][col]);
}  
public static void printCol(int[][] table, int col)
{ 
 for(int row = 0; row &lt; table[row].length; row++)
   System.out.println(table[row][col]);
}  


public static int search(int[] list, int n) // returns the index of n else returns -1
{
 for(int i = 0; i &lt; list.length; i++)
  if(list[i] == n) return i;
 return -1;
}
public static boolean isInOrder(int[] list)
{
 for(int i = 0; i &lt; list.length - 1; i++)
  if(list[i] &gt; list[i+1])
   return false;
 return true;
}
public static void printArrayList(ArrayList list) // assume list contains String objects
{
 for(int i = 0; i &lt; list.size(); i++)
  System.out.println(list.get(i));
}
public static int myIndexOf(ArrayList list, String s)// returns the indexOf s
{
 return list.indexOf(s);
}
public static void setAll(ArrayList list, String s) // sets all of the elements in list to s
{
 for(int i = 0; i &lt; list.size(); i++)
  list.set(i,s); 
}
public static void removeFirstAndLast(ArrayList list) // removes first and last elements of list
{
 list.remove(0);
 list.remove(list.size()-1);
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-116613968174847668?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/116613968174847668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=116613968174847668' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116613968174847668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116613968174847668'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/12/finalmethodsreviewjava.html' title='finalMethodsReview.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-116458000712893943</id><published>2006-11-26T14:26:00.000-08:00</published><updated>2006-12-14T15:45:11.410-08:00</updated><title type='text'>ForEachExample.java</title><content type='html'>public class ForEachExample
{
 public static void main(String[] args)
 {
  int[] list = {1,2,3,4,5};
  
  for(int num: list)
   System.out.println(num);
 }
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-116458000712893943?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/116458000712893943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=116458000712893943' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116458000712893943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116458000712893943'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/11/foreachexamplejava.html' title='ForEachExample.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-116457993050033641</id><published>2006-11-26T14:25:00.000-08:00</published><updated>2006-12-14T15:44:23.836-08:00</updated><title type='text'>ArrayListLoops.java</title><content type='html'>import java.util.*;

public class ArrayListLoops
{
    public static void main(String[] args)
    {
        ArrayList list = new ArrayList();

        list.add("Washington");
        list.add("Adams");
        list.add("Jefferson");
        list.add("Madison");

  System.out.println("version 1");
        for (int i = 0; i &lt; list.size(); i++)
            System.out.println(list.get(i));
  
  System.out.println("version 2");
        ListIterator it = list.listIterator();

        while (it.hasNext())
        {
            System.out.println(it.next());
        }
        
  System.out.println("version 3");
  for(Object president: list)
   System.out.println((String)president);
    }
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-116457993050033641?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/116457993050033641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=116457993050033641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116457993050033641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116457993050033641'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/11/arraylistloopsjava.html' title='ArrayListLoops.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-116248410859472947</id><published>2006-11-02T08:15:00.000-08:00</published><updated>2006-12-14T15:44:51.963-08:00</updated><title type='text'>DogTest.java</title><content type='html'>public class DogTest{
 public static void main(String[] args)
 {
  Dog d1 = new Dog("Buddy");
  d1.setBreed("mutt");
  d1.bark();
  System.out.println(d1);
  System.out.println(d1.getName());
 }
}
class Dog
{
 private String name, breed;
 
 public Dog()
 {
 }
 
 public Dog(String name)
 {
  this.name = name;
 }
 
 public void setName(String name)
 {
  this.name = name;
 }
 
 public String getName()
 {
  return name;
 }
 
 public void setBreed(String breed)
 {
  this.breed = breed;
 }
 
 public String getBreed()
 {
  return breed;
 }
 public String toString()
 {
  return name;
 }
 
 public void bark()
 {
  System.out.println("bow wow");
 }
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-116248410859472947?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/116248410859472947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=116248410859472947' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116248410859472947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116248410859472947'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/11/dogtestjava.html' title='DogTest.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-116248373393931132</id><published>2006-11-02T08:08:00.000-08:00</published><updated>2006-11-02T08:08:54.050-08:00</updated><title type='text'>MethodsReview</title><content type='html'>public static boolean isEven(int n) { return n % 2 == 0; }
public static boolean isOdd(int n)	{ return n % 2 == 1; }
public static boolean isPositive(int n)	{ return n &gt; 0; }
public static boolean isPrime(int n) {
	boolean isPrime = true;
	for(int i = 2; i &lt; n; i++)
		if (n % i == 0)
			isPrime = false;
	return isPrime;
}
public static boolean isATriangle(int numSides) { return numSides == 3; }
public static boolean isEquilateral(int side1, int side2, int side3)
{ return side1 == side2 &amp;&amp; side2 == side3; }
public static boolean isRightTriangle(int angle1, int angle2, int angle3)
{ return angle1 == 90 || angle2 == 90 || angle3 == 90; }
public static boolean isVowel(char c) // precondition:  c is lowercase
{	return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; }
public static int countVowels(String s) // use isVowel(char c)
{
	int count = 0;
	for(int i = 0; i &lt; s.length() i++)
		if(isVowel(c))	count++;
	return count;
}	
public static boolean isAlphabetic(char c)
{	return ( c &gt;= 'a' &amp; c &lt;= 'z') || ( c &gt;= 'A' &amp; c &lt;= 'Z') ;
public static boolean isConsonant(char c) // Use above methods
{	return isAlphabetic(c) &amp;&amp; ! isVowel(c); }
public static double areaSquare(double side1, double side2)
{	return side1 * side2; }
public static double areaCircle(double radius)
{	return Math.PI * Math.pow(radius,2);  }
public static boolean isInRange(int num, int bottom, int top)
{	return n &gt;= bottom &amp;&amp; num &lt;= top;  }
public static int sumRange(int bottom, int top) // inclusive
{
	int sum = 0;
	for (int i = bottom; i &lt;= top; i++)
		sum += i;
	return sum;
}
public static int averageRange(int bottom, int top) // inclusive
{
	int count = top - bottom + 1;
	return sumRange(top, bottom) / count;
}
public static int min(int num1, int num2)
{
	if(num1 &lt; num2)
		return num1;
		else
		return num2;
}
public static int max(int num1, int num2)
{
	if(num1 &gt; num2)
		return num1;
		else
		return num2;
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-116248373393931132?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/116248373393931132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=116248373393931132' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116248373393931132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116248373393931132'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/11/methodsreview.html' title='MethodsReview'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-116171298149300281</id><published>2006-10-24T11:03:00.000-07:00</published><updated>2006-10-24T17:52:46.076-07:00</updated><title type='text'>CarTest</title><content type='html'>public class CarTest
{
 public static void main(String[] args)
 {
  Car c1 = new Car("Toyota");
  c1.drive(50);
  System.out.println(c1 + " mileage = " + c1.getMileage());
  c1.drive(50);
  System.out.println(c1 + " mileage = " + c1.getMileage());
  System.out.println("total cars = " + Car.getCount());
  
  Car c2 = new Car("Honda");
  c2.drive(10);
  System.out.println(c2 + " mileage = " + c2.getMileage());
  c2.drive(15);
  System.out.println(c2 + " mileage = " + c2.getMileage());
  System.out.println("total cars = " + Car.getCount());
  
 }
}

class Car
{
 private String make;
 private int mileage;
 private static int count = 0;
 
 public Car(String make)
 {
  this.make = make;
  count++;
 }

 public String getMake()
 {
  return make;
 }
 
 public int getMileage()
 {
  return mileage;
 }
 
 public static int getCount()
 {
  return count;
 }

 public String toString()
 {
  return make;
 }
 
 public void drive(int miles)
 {
  mileage += miles; 
 }
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-116171298149300281?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/116171298149300281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=116171298149300281' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116171298149300281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/116171298149300281'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/10/cartest.html' title='CarTest'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-115885169845255037</id><published>2006-09-21T08:14:00.000-07:00</published><updated>2006-09-21T08:14:58.456-07:00</updated><title type='text'>Program3_5</title><content type='html'>import java.util.*;
public class Program3_5
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String s;
		
		System.out.print("Enter a string: ");
		s = scan.next();
		
		for(int i = 0; i &lt; s.length(); i++)
			System.out.println(s.charAt(i));
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-115885169845255037?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/115885169845255037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=115885169845255037' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885169845255037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885169845255037'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/09/program35.html' title='Program3_5'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-115885102888311551</id><published>2006-09-21T08:03:00.002-07:00</published><updated>2006-09-21T08:03:48.886-07:00</updated><title type='text'>ForLoopExample</title><content type='html'>public class ForLoopExample
{
	public static void main(String[] args)
	{
	for(int num = 1; num &lt;= 10; num++)
			System.out.println(num);
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-115885102888311551?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/115885102888311551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=115885102888311551' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885102888311551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885102888311551'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/09/forloopexample.html' title='ForLoopExample'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-115885101940808584</id><published>2006-09-21T08:03:00.001-07:00</published><updated>2006-09-21T08:03:39.413-07:00</updated><title type='text'>WhileExample2</title><content type='html'>public class WhileExample2
{
	public static void main(String[] args)
	{
		int num = 1;
		while(num &lt;= 10)
		{
			System.out.println(num);
			num++;	
		}
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-115885101940808584?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/115885101940808584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=115885101940808584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885101940808584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885101940808584'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/09/whileexample2.html' title='WhileExample2'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-115885100692533342</id><published>2006-09-21T08:03:00.000-07:00</published><updated>2006-09-21T08:03:27.016-07:00</updated><title type='text'>WhileExample</title><content type='html'>import java.util.*;
public class WhileExample
{
	public static void main(String[] args)
	{
		String response = "y";
		
		Scanner scan = new Scanner(System.in);
		
		while (response.equalsIgnoreCase("y"))
		{
			//code goes here
		
			System.out.print("Again? (y/n): ");
			response = scan.next();
		
		}
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-115885100692533342?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/115885100692533342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=115885100692533342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885100692533342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115885100692533342'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/09/whileexample.html' title='WhileExample'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-115703913754692361</id><published>2006-08-31T08:45:00.000-07:00</published><updated>2006-08-31T08:45:38.203-07:00</updated><title type='text'>AreaRectangle2</title><content type='html'>import java.util.*;
public class AreaRectangle2
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int area, length, width;
		
		System.out.print("Enter length: ");
		length = scan.nextInt();
		System.out.print("Enter width: ");
		width = scan.nextInt();
		
		area = length * width;
		System.out.println("The area of the rectangle is " + area);
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-115703913754692361?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/115703913754692361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=115703913754692361' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115703913754692361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/115703913754692361'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/08/arearectangle2.html' title='AreaRectangle2'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030675407544496</id><published>2006-02-18T15:52:00.002-08:00</published><updated>2006-02-18T15:52:34.080-08:00</updated><title type='text'>Demo2.java</title><content type='html'>public class Demo2 {
    public static void main(String[] args) {

        for (int i = 0; i &lt; args.length; i++)
            System.out.println("You entered " + args[i]);
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030675407544496?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030675407544496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030675407544496' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030675407544496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030675407544496'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/demo2java.html' title='Demo2.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030674429276879</id><published>2006-02-18T15:52:00.001-08:00</published><updated>2006-02-18T15:52:24.296-08:00</updated><title type='text'>WrapperDemo.java</title><content type='html'>import java.util.*;
public class WrapperDemo
{
	public static void main(String[] args)
	{
		ArrayList numList = new ArrayList();
		
		numList.add(2006);
		
		int num;
		
		// num = numList.get(0);   this won't work
		
		num = (Integer)numList.get(0);
		
		System.out.println(num);
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030674429276879?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030674429276879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030674429276879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030674429276879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030674429276879'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/wrapperdemojava.html' title='WrapperDemo.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030672151356247</id><published>2006-02-18T15:52:00.000-08:00</published><updated>2006-02-18T15:52:01.516-08:00</updated><title type='text'>BookTest.java</title><content type='html'>import java.util.*;

public class BookTest {
    public static void main(String[] args) {
        

        ArrayList aList = new ArrayList();

        Book b1 = new Book("Catcher In The Rye");
        Book b2 = new Book("Crime and Punishment");

        aList.add(b1);
        aList.add(b2);

        for (int i = 0; i &lt; aList.size(); i++)
        {
        	// System.out.println(aList.get(i).getName()); 	THIS WON'T WORK
        	
            Book b = (Book) aList.get(i);   // ArrayList object must be typecast as Book
            System.out.println(b.getName());
        }  

		System.out.println("There are " + Book.getCount() + " books.");
      }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030672151356247?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030672151356247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030672151356247' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030672151356247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030672151356247'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/booktestjava.html' title='BookTest.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030670705192470</id><published>2006-02-18T15:51:00.001-08:00</published><updated>2006-02-18T15:51:47.056-08:00</updated><title type='text'>Total.java</title><content type='html'>public class Total
{
	public static void main(String[] args)
	{
		int total = 0;
		
		for(int i = 0; i &lt; args.length; i++)
			total += Integer.parseInt(args[i]);
			
		System.out.println("total equals " + total);		
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030670705192470?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030670705192470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030670705192470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030670705192470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030670705192470'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/totaljava.html' title='Total.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030666042389404</id><published>2006-02-18T15:51:00.000-08:00</published><updated>2006-02-18T15:51:00.426-08:00</updated><title type='text'>Book.java</title><content type='html'>public class Book
{
	private String name;
	static int count = 0;
	
	public Book()
	{
		count++;
	}
	public Book(String name)
	{
		this.name = name;
		count++;
	}
	public void setName(String name)
	{
		this.name = name;
	}
	public String getName()
	{
		return name;
	}
	public String toString()
	{
		return name;
	}
	public static int getCount()
	{
		return count;
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030666042389404?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030666042389404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030666042389404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030666042389404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030666042389404'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/bookjava.html' title='Book.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030659409672673</id><published>2006-02-18T15:49:00.003-08:00</published><updated>2006-02-18T15:49:59.296-08:00</updated><title type='text'>Demo.java</title><content type='html'>public class Demo {
    public static void main(String[] args) {
    
        System.out.println("You entered " + args[0]);
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030659409672673?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030659409672673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030659409672673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030659409672673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030659409672673'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/demojava.html' title='Demo.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030656847738620</id><published>2006-02-18T15:49:00.002-08:00</published><updated>2006-02-18T15:49:28.476-08:00</updated><title type='text'>ArraysAsParameters.java</title><content type='html'>public class ArraysAsParameters
{

	public static void main(String[ ] args)
	{
	 	String president = "Bill Clinton";
		String[] list = {"John","Paul","George","Pete"};
		
		
		change(president);
		change(list);
		
		System.out.println(president);
		
		for(int k = 0; k &lt; list.length; k++)
			System.out.println(list[k]);
			
	}
	
	public static void change(String[] list)
	{
		list[3] = "Ringo";
	}
	
	public static void change(String president)
	{
		president = "George Bush";
	}
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030656847738620?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030656847738620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030656847738620' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030656847738620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030656847738620'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/arraysasparametersjava.html' title='ArraysAsParameters.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030656776002192</id><published>2006-02-18T15:49:00.001-08:00</published><updated>2006-02-18T15:49:27.770-08:00</updated><title type='text'>Multiply.java</title><content type='html'>public class Multiply {
    public static void main(String[] args) {
    
        int num1 = Integer.parseInt(args[0]);
        int num2 = Integer.parseInt(args[1]);

        int product = num1 * num2;

        System.out.println("Product equals " + product);
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030656776002192?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030656776002192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030656776002192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030656776002192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030656776002192'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/multiplyjava.html' title='Multiply.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030654261296757</id><published>2006-02-18T15:49:00.000-08:00</published><updated>2006-02-18T15:49:02.613-08:00</updated><title type='text'>CreateArrayLists.java</title><content type='html'>import java.util.*;

public class CreateArrayLists
{
	public static void main(String[ ] args)
	{
		ArrayList planets = new ArrayList();

		planets.add("Mercury");
		planets.add("Venus");
		planets.add("Mars");
		planets.add("Earth");
		
		for(int k = 0; k &lt; planets.size(); k++)
			System.out.println(planets.get(k));
	
		System.out.println();
		
		planets.set(2,"Earth");
		planets.set(3,"Mars");
					
					
      Iterator it = planets.iterator();  // ArrayLists implement the List interface

        while (it.hasNext()) {
            System.out.println(it.next());
           
        }
        
        String s = (String)planets.get(2);
        
        System.out.println(s);
			
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030654261296757?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030654261296757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030654261296757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030654261296757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030654261296757'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/createarraylistsjava.html' title='CreateArrayLists.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114030651955574116</id><published>2006-02-18T15:48:00.000-08:00</published><updated>2006-02-18T15:48:39.560-08:00</updated><title type='text'>CreateArrays.java</title><content type='html'>public class CreateArrays
{
	public static void main(String[] args)
	{
		int[] intArray = new int[5];   // create array using new operator
		int[] intArray2 = {1492, 1776, 1860, 1917, 1945}; // initalizer list
		
		String[] stringArray = new String[5];
		String[] stringArray2 = {"mon","tue","wed","thu","fri"};
		
		printIntArray(intArray);
		printIntArray(intArray2);
		
		printStringArray(stringArray);
		printStringArray(stringArray2);
		
	}
	
	public static void printIntArray(int[] list)
	{
		for(int i = 0; i &lt; list.length; i++)
			System.out.println(list[i]);
			
		System.out.println();
	}
	public static void printStringArray(String[] list)
	{
		for(int i = 0; i &lt; list.length; i++)
			System.out.println(list[i]);
			
		System.out.println();
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114030651955574116?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114030651955574116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114030651955574116' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030651955574116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114030651955574116'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/createarraysjava.html' title='CreateArrays.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114013685542180029</id><published>2006-02-16T16:40:00.002-08:00</published><updated>2006-02-16T16:40:55.426-08:00</updated><title type='text'>Server.java</title><content type='html'>import cs1.*;

import java.text.*;


public class Server {
    private String name;

    public Server(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String toString() {
        return name;
    }

    public void greet() {
        System.out.println("Hello, my name is " + name);
        System.out.println("I will be your server today.");
    }

    public void serve(Customer c, Menu m) {
        System.out.println();
        System.out.println("Menu");
        m.display();

        for (;;) {
            System.out.print("Please select from the menu (0 to quit): ");

            int item = Keyboard.readInt();

            if (item &lt;= 0) {
                break;
            }

            if (item &gt; m.numberOfMenuItems()) {
                System.out.println("Sorry, that's not a valid item number.");
            } else {
                c.order(item);
            }
        }

        System.out.println("\n" + "Order summary for customer #" +
            c.getNumber() + ": ");
        c.displayOrder();

        double subtotal = c.getSubtotal();
        NumberFormat money = NumberFormat.getCurrencyInstance();
        System.out.println("Subtotal = \t" + money.format(subtotal));
        System.out.println("Tax = \t\t" + money.format(c.getTax(subtotal)));
        System.out.println("Total = \t" + money.format(c.getTotal(subtotal)));
        System.out.println("===================================");
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114013685542180029?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114013685542180029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114013685542180029' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013685542180029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013685542180029'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/serverjava_16.html' title='Server.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114013681526532136</id><published>2006-02-16T16:40:00.001-08:00</published><updated>2006-02-16T16:40:15.286-08:00</updated><title type='text'>Menu.java</title><content type='html'>import java.text.*;
import java.util.*;

public class Menu {
    ArrayList item = new ArrayList();
    ArrayList price = new ArrayList();

    public Menu() {
    }

    public void display() {
        NumberFormat money = NumberFormat.getCurrencyInstance();

        for (int i = 0; i &lt; item.size(); i++) {
            System.out.println((i + 1) + "\t" + item.get(i) + "\t" +
                money.format(price.get(i)));
        }
        System.out.println();
    }

    public void addItem(String s, double d) {
        item.add(s);
        price.add(new Double(d));
    }

    public String getItem(int i) {
        return (String) item.get(i);
    }

    public double getPrice(int i) {
        return ((Double) price.get(i)).doubleValue();
    }

    public int numberOfMenuItems() {
        return item.size();
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114013681526532136?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114013681526532136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114013681526532136' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013681526532136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013681526532136'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/menujava.html' title='Menu.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114013680410428963</id><published>2006-02-16T16:40:00.000-08:00</published><updated>2006-02-16T16:40:04.113-08:00</updated><title type='text'>Restaurant.java</title><content type='html'>import java.util.*;
import cs1.*;

public class Restaurant {
    public static void main(String[] args) {
    
        Locale.setDefault(Locale.US); // So monetary output uses $

        Orders orders = new Orders();

        Menu m1 = new Menu();
        boolean nextCustomer = false;
        String response;
        
        m1.addItem("Hamburger", 2.50);
        m1.addItem("French fries", 1.50);
        m1.addItem("Soft drink", 1.00);

        Server s1 = new Server("Kevin");

        do{
            Customer c = new Customer(m1);
            orders.addCustomer(c);
            s1.greet();
            s1.serve(c, m1);
            System.out.print("Next customer? (y/n): ");
            response = Keyboard.readString();
            nextCustomer = response.equals("y");
       } while (nextCustomer);
       
        orders.displayOrders();
        orders.displayTotal();
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114013680410428963?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114013680410428963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114013680410428963' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013680410428963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013680410428963'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/restaurantjava.html' title='Restaurant.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114013679791755784</id><published>2006-02-16T16:39:00.002-08:00</published><updated>2006-02-16T16:39:57.926-08:00</updated><title type='text'>Customer.java</title><content type='html'>import java.text.*;
import java.util.*;

public class Customer {
    final static double TAXRATE = 0.0825;
    private static int nextCustomerNumber;
    private int customerNumber;
    private ArrayList orderList = new ArrayList();
    private Menu menu; // the menu the customer is ordering from
    private double total;

    public Customer(Menu m) // customer will order from menu m
     {
        menu = m;
        customerNumber = nextCustomerNumber + 1;
        nextCustomerNumber++;
    }

    public int getNumber() {
        return customerNumber;
    }

    public String toString() {
        return Integer.toString(customerNumber);
    }

    public void order(int item) {
        // If the menu has N items, someone orders an item using a number
        // from 1 through N.  Internally, our program will represent these
        // using the numbers 0 through N-1.
        orderList.add(new Integer(item - 1));
    }

    public void displayOrder() {
        NumberFormat money = NumberFormat.getCurrencyInstance();

        for (int i = 0; i &lt; orderList.size(); i++) {
            int itemNumber = ((Integer) orderList.get(i)).intValue();
            System.out.println(menu.getItem(itemNumber) + "\t" +
                money.format(menu.getPrice(itemNumber)));
        }

        System.out.println();
    }

    public double getSubtotal() {
        double subtotal = 0.0;

        for (int i = 0; i &lt; orderList.size(); i++) {
            int itemNumber = ((Integer) orderList.get(i)).intValue();
            subtotal += menu.getPrice(itemNumber);
        }

        return subtotal;
    }

    public double getTax(double subtotal) {
        return subtotal * TAXRATE;
    }

    public double getTotal(double subtotal) {
        total = subtotal + getTax(subtotal);

        return subtotal + getTax(subtotal);
    }

    public double returnTotal() {
        return total;
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114013679791755784?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114013679791755784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114013679791755784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013679791755784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013679791755784'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/customerjava.html' title='Customer.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-114013676338254170</id><published>2006-02-16T16:39:00.001-08:00</published><updated>2006-02-16T16:39:23.386-08:00</updated><title type='text'>Orders.java</title><content type='html'>import java.text.*;
import java.util.*;

public class Orders {
    private ArrayList customerList = new ArrayList();
	private Customer c;
	private double totalSales = 0.0;
	
    public Orders() {
    }
    public void addCustomer(Customer c){
    	customerList.add(c);
    }
    public void displayOrders(){
    	System.out.println("All Orders");
    	System.out.println("----------");
    	for(int i = 0; i &lt; customerList.size(); i++){
    	
    		c = (Customer)customerList.get(i);
    		c.displayOrder();

    		}
    }
    private double calcTotalSales(){
    	for(int i = 0; i &lt; customerList.size(); i++){
    	
    		c = (Customer)customerList.get(i);
    		totalSales += c.returnTotal();

    		}
    	return totalSales;
    
    }
    public void displayTotal()
    {
        NumberFormat money = NumberFormat.getCurrencyInstance();
    	System.out.println("Total Sales (including tax)");
    	System.out.println("----------");
		System.out.println(money.format(calcTotalSales()));    
    
    }
    

}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-114013676338254170?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/114013676338254170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=114013676338254170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013676338254170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/114013676338254170'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/ordersjava.html' title='Orders.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113892349030721222</id><published>2006-02-02T15:38:00.000-08:00</published><updated>2006-02-06T13:22:56.263-08:00</updated><title type='text'>Fahrenheit.java</title><content type='html'>public class Fahrenheit
{
   public static void main (String[] args)
   {
      FahrenheitGUI converter = new FahrenheitGUI();
      converter.display();
   }
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113892349030721222?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113892349030721222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113892349030721222' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113892349030721222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113892349030721222'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/fahrenheitjava.html' title='Fahrenheit.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113892323964854675</id><published>2006-02-02T15:33:00.000-08:00</published><updated>2006-02-02T15:33:59.653-08:00</updated><title type='text'>FahrenheitGUI.java</title><content type='html'>//********************************************************************
//  FahrenheitGUI.java       Author: Lewis/Loftus/Cocking
//
//  Demonstrates the use of JFrame and JTextArea GUI components.
//********************************************************************

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class FahrenheitGUI
{
   private int WIDTH = 300;
   private int HEIGHT = 75;

   private JFrame frame;
   private JPanel panel;
   private JLabel inputLabel, outputLabel, resultLabel;
   private JTextField fahrenheit;

   //-----------------------------------------------------------------
   //  Sets up the GUI.
   //-----------------------------------------------------------------
   public FahrenheitGUI()
   {
      frame = new JFrame ("Temperature Conversion");
      frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);

      inputLabel = new JLabel ("Enter Fahrenheit temperature:");
      outputLabel = new JLabel ("Temperature in Celsius: ");
      resultLabel = new JLabel ("---");

      fahrenheit = new JTextField (5);
      fahrenheit.addActionListener (new TempListener());

      panel = new JPanel();
      panel.setPreferredSize (new Dimension(WIDTH, HEIGHT));
      panel.setBackground (Color.yellow);
      panel.add (inputLabel);
      panel.add (fahrenheit);
      panel.add (outputLabel);
      panel.add (resultLabel);

      frame.getContentPane().add (panel);
   }
   //-----------------------------------------------------------------
   //  Displays the primary application frame.
   //-----------------------------------------------------------------
   public void display()
   {
      frame.pack();
      frame.setVisible(true);
   }

   //*****************************************************************
   //  Represents an action listener for the temperature input field.
   //*****************************************************************
   private class TempListener implements ActionListener
   {
      //--------------------------------------------------------------
      //  Performs the conversion when the enter key is pressed in
      //  the text field.
      //--------------------------------------------------------------
      public void actionPerformed (ActionEvent event)
      {
         int fahrenheitTemp, celsiusTemp;

         String text = fahrenheit.getText();

         fahrenheitTemp = Integer.parseInt (text);
         celsiusTemp = (fahrenheitTemp-32) * 5/9;

         resultLabel.setText (Integer.toString (celsiusTemp));
      }
   }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113892323964854675?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113892323964854675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113892323964854675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113892323964854675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113892323964854675'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/fahrenheitguijava.html' title='FahrenheitGUI.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113886040799827037</id><published>2006-02-01T22:06:00.000-08:00</published><updated>2006-02-01T22:06:48.000-08:00</updated><title type='text'>PoundstoKilograms.java</title><content type='html'>public class PoundstoKilograms {
    public static void main(String[] args) {
        String title = new String("Weight conversion");
        String label1 = new String("Pounds");
        String label2 = new String("Kilograms");

        PoundstoKilogramsGUI converter = new PoundstoKilogramsGUI(title,
                label1, label2);
        converter.display();
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113886040799827037?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113886040799827037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113886040799827037' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113886040799827037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113886040799827037'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/02/poundstokilogramsjava.html' title='PoundstoKilograms.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113875378891115144</id><published>2006-01-31T16:29:00.000-08:00</published><updated>2006-01-31T16:36:35.346-08:00</updated><title type='text'>PoundstoKilogramsGUI.java</title><content type='html'>import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class PoundstoKilogramsGUI
{
   private int WIDTH = 300;
   private int HEIGHT = 75;

   private JFrame frame;
   private JPanel panel;
   private JLabel inputLabel, outputLabel, resultLabel;
   private JTextField pounds;

   public PoundstoKilogramsGUI(String title, String label1, String label2)
   {
      frame = new JFrame (title);
      frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);

      inputLabel = new JLabel (label1);
      outputLabel = new JLabel (label2);
      resultLabel = new JLabel ("---");

      pounds = new JTextField (5);
      pounds.addActionListener (new TempListener());

      panel = new JPanel();
      panel.setPreferredSize (new Dimension(WIDTH, HEIGHT));
      panel.setBackground (Color.yellow);
      panel.add (inputLabel);
      panel.add (pounds);
      panel.add (outputLabel);
      panel.add (resultLabel);

      frame.getContentPane().add (panel);
   }
   public void display()
   {
      frame.pack();
      frame.setVisible(true); // book has old version
   }

   private class TempListener implements ActionListener
   {
      public void actionPerformed (ActionEvent event)
      {
         Double poundsTemp, kilogramsTemp;

         String text = pounds.getText();

         poundsTemp = Double.parseDouble(text);
         kilogramsTemp = poundsTemp / 2.2 ;

         resultLabel.setText (Double.toString (kilogramsTemp));
      }
   }
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113875378891115144?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113875378891115144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113875378891115144' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875378891115144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875378891115144'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/01/poundstokilogramsguijava.html' title='PoundstoKilogramsGUI.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113875242007895670</id><published>2006-01-31T16:07:00.000-08:00</published><updated>2006-01-31T16:07:00.080-08:00</updated><title type='text'>MyClassTest.java</title><content type='html'>import java.util.*;
public class MyClassTest
{
	public static void main(String[] args)
	{
		MyClass object1 = new MyClass("sam");
		MyClass object2 = new MyClass("bruce");
		MyClass object3 = new MyClass("fred");
		
		MyClass[] list = {object1, object2, object3};
		
		for(int i = 0; i &lt; list.length; i++)
			System.out.println(list[i]);
			
		ArrayList alist = new ArrayList();
		
		alist.add(object1);
		alist.add(object2);
		alist.add(object3);
		
		Iterator it = alist.iterator();
		
		while(it.hasNext())
		{
			System.out.println(it.next());
		}
	
		System.out.println("There are " + MyClass.getCount() + " objects.");
	}
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113875242007895670?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113875242007895670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113875242007895670' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875242007895670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875242007895670'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/01/myclasstestjava.html' title='MyClassTest.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113875129979320570</id><published>2006-01-31T15:48:00.000-08:00</published><updated>2006-01-31T15:48:19.796-08:00</updated><title type='text'>MyClass.java</title><content type='html'>public class MyClass
{
	private String name;
	private static int count;
	
	public MyClass()
	{
		count++;
	}
	
	public MyClass(String name)
	{
		this.name = name;
		count++;
	}
	
	public void setName(String name)
	{
		this.name = name;
	}
	
	public String getName()
	{
		return name;
	}
	
	public String toString()
	{
		return name;
	}
	public static int getCount()
	{
		return count;
	}
	
}
	
	&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113875129979320570?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113875129979320570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113875129979320570' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875129979320570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875129979320570'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/01/myclassjava.html' title='MyClass.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113875080666947654</id><published>2006-01-31T15:40:00.000-08:00</published><updated>2006-01-31T15:40:06.673-08:00</updated><title type='text'>Dog.java</title><content type='html'>public class Dog implements Animal {
    private String name;

    public Dog() {
    }

    public Dog(String name) {
        this.name = name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String toString() {
        return name;
    }

    public void speak() {
        System.out.println("bow wow");
    }
}
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113875080666947654?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113875080666947654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113875080666947654' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875080666947654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875080666947654'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/01/dogjava.html' title='Dog.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21717786.post-113875077216007624</id><published>2006-01-31T15:39:00.000-08:00</published><updated>2006-01-31T16:32:41.356-08:00</updated><title type='text'>Animal.java</title><content type='html'>public interface Animal
{
 public void speak();
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21717786-113875077216007624?l=javascratchpad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascratchpad.blogspot.com/feeds/113875077216007624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21717786&amp;postID=113875077216007624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875077216007624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21717786/posts/default/113875077216007624'/><link rel='alternate' type='text/html' href='http://javascratchpad.blogspot.com/2006/01/animaljava.html' title='Animal.java'/><author><name>George</name><uri>http://www.blogger.com/profile/04506732417664712378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
