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
/* | |
Builds a Java program that generates a ‘random’ (drunk) walk across a 10 X 10 array. | |
Initially the array will contain all periods(‘.’) | |
The program must randomly ‘walk’ from element to element; | |
Always going up, down, right, or left (no diagonal) by one element. |
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
/***************************************************** | |
* | |
* Program Name: Password | |
* | |
* Author: Henry Nichols | |
* | |
* Remarks: JOptionPane examples | |
* | |
*****************************************************/ |
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
// Builds a simple JList GUI that displays implementation descriptions for keywords when one is selected | |
import javax.swing.*; | |
import javax.swing.event.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
class HelpGUI implements ListSelectionListener, ActionListener { | |
JButton close; |
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 javax.swing.JOptionPane; | |
public class StringOddEven { | |
public static void main(String args[]) { | |
String input = JOptionPane.showInputDialog("Please enter a string."); | |
int length = input.length(); | |
if (length % 2 == 0) { | |
System.out.println(input); | |
} 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 static void main(String args[]) { | |
// Declare variables | |
int index = 0, first = 0, second = 1; | |
System.out.println("Fibonacci Sequence"); | |
System.out.println(); | |
// Using a WHILE loop for this program. | |
while (index < 21) { |
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
class FizzBuzz { | |
public static void main(String args[]) { | |
// Declare local variables | |
int num; | |
// Using a FOR loop for this program. | |
for (num = 1; num < 73; num++) { | |
if (num % 35 == 0) | |
System.out.println("FizzBuzz"); | |
else if (num % 7 == 0) |
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.Scanner; | |
class LeapYear { | |
public static void main(String args[]) | |
{ | |
// Declare variables | |
int year; | |
boolean status; | |
Scanner scanIn = new Scanner(System.in); |
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
// Print a truth table for the logical operators. | |
class LogicalOpTable { | |
public static void main(String args[]) { | |
boolean p, q; | |
int pVal = 0, qVal = 0, pqAndVal= 0, pqOrVal = 0, pqExOrVal = 0, pNotVal = 0; | |
System.out.println("P\tQ\tAND\tOR\tXOR\tNOT"); |
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
//------------------------------------------------------------------------------------------------------------------ | |
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
//------------------------------------------------------------------------------------------------------------------ | |
function Animal(name, number_of_legs) { | |
this.name = name; | |
this.number_of_legs = number_of_legs; | |
} | |
Animal.prototype.identify = function(){ |
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
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
NewerOlder