This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
import javax.swing.event.*; | |
import java.util.*; | |
import java.awt.image.BufferedImage; | |
public class AnimationRB1 extends JFrame implements | |
ActionListener, ChangeListener { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListNode | |
{ | |
private int data; | |
private ListNode next; | |
public ListNode() | |
{ | |
data = 0; | |
next = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
/** | |
* Write a description of class Dice here. | |
* | |
* @author (your name) | |
* @version (a version number or a date) | |
*/ | |
public class DiceRandom | |
{ | |
Random rn = new Random(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class Balloon { | |
private int x = 50; | |
private int y = 50; | |
private int diameter = 20; | |
public void moveRight(int xStep) { | |
x = x + xStep; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TowersOfHanoi | |
{ | |
public int[][] pegs = new int[3][8]; | |
public void setUp(int discs) { | |
for (int x = 0; x < discs; x++) { | |
pegs[0][x] = discs - x; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PascalsTriangle { | |
public int pascal (int n, int r) { | |
int ans; | |
if (r == 0 || r == n) { | |
ans = 1; | |
} | |
if (r == 1 || r == n - 1) { | |
ans = n; | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Fibonacci { | |
public int fib (int n) { | |
int ans; | |
if (n <= 2) { | |
ans = 1; | |
} | |
else { | |
ans = fib (n-1) + fib (n-2); | |
} | |
return ans; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
/** | |
* Created by User on 2/10/15. | |
*/ | |
import sun.jvm.hotspot.utilities.BitMap; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int factorial (int n) { | |
int ans; | |
if (n < 2) { | |
ans = 1; | |
} | |
else { | |
ans = n * factorial (n-1); | |
} | |
return ans; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
import javax.swing.event.*; | |
import java.util.*; | |
public class GameOfLife extends JFrame | |
{ |