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
Tonight I decided to set something interesting to happen every time I open the Terminal. | |
I decided to use cowsay (http://www.nog.net/~tony/warez/cowsay.shtml) | |
and fortune (http://en.wikipedia.org/wiki/Fortune_(Unix) to have a "cow" (kitten in my case) | |
give out random quotes from Portal, the Hitchhiker's Guide to the Galaxy and Monty Python and the Holy Grail. | |
I was successful, and decided to share my method. | |
First, you should install both programs: | |
brew install fortune | |
brew install cowsay |
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
# Restaurbot | |
$done = false | |
orders = [ | |
'pizza', 'macaroni' | |
] | |
puts 'Hello. What is your name?' | |
$name = gets.chomp.capitalize |
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
#!/bin/bash | |
open -A /Applications/iA\ Writer.app/ $1 |
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
// name: | |
// purpose: determine minimum age of a possible date | |
import java.util.Scanner; // imports the "Scanner" library, which allows the program to set up a new Scanner object | |
public class BBaileyDateable | |
{ | |
// method main(): program starting point | |
public static void main( String[] args ) | |
{ |
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.*; | |
import java.awt.*; | |
import java.io.*; | |
/** | |
* Class that represents a turtle which is similar to a Logo turtle. | |
* This class inherts from SimpleTurtle and is for students | |
* to add methods to. | |
* | |
* Copyright Georgia Institute of Technology 2004 |
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 TurtleRunner | |
{ | |
public static void main(String args[]) | |
{ | |
//create a world for your turtles | |
World turtleWorld = new World(600,800); //creates the turtle canvas | |
//create a picture | |
Picture turtle = new Picture("images.jpg"); //lets java know where the picture is |
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
// name: | |
// purpose: demonstrate further method prowess | |
public class BBaileyInvoke | |
{ | |
// method piggyBank(): returns what the change is worth in cents | |
public static int piggyBank(int pennies, int nickles, int dimes, int quarters, int halfDollars) //creates the piggyBank method, which takes the arguments pennies, nickles, dimes, quarters, and halfDollars | |
{ | |
double money = (pennies *.01) + (nickles*.05) + (dimes*.1) + (quarters*.25) + (halfDollars*.5); //calculates the amount of money needed |
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 BBaileyBook //the name of the class should be "Book" | |
{ | |
private String bookName; //the variables need to be private because they are instance variables | |
private int bookISBN; //you don't need to assign default values because they are assigned in the constructors | |
public BBaileyBook(){ //default constructor named book that should provide default values ("" and 0, respectively) for the instance variables | |
bookName = ""; //when no arguments are passed, the title defaults to "" | |
bookISBN = 0; //when no arguments are passed, the ISBN defaults to 0 | |
} | |
public BBaileyBook(String name, int isbn){ //creates a book object and assigns the name and isbn arguments to the instance variables |
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 BBaileyBookRunner | |
{ | |
public static void main(String args[]) | |
{ | |
BBaileyBook textBook = new Book(); //creates a new object textbook of class Book | |
textBook.setName("Scooby Doo"); //sets the name of textBook to "Scooby Doo" | |
textBook.getName(); //println would print default values if the default constructor was called. In this case, the output matches the input | |
System.out.println(textBook); //What does this line do? It calls the .toString() method | |
BBaileyBook theStranger = new Book("The Stranger", 123456789); //creates a new book with title "The Stranger" and ISBN 123... | |
System.out.println(textBook.getName); //prints textBook's name |
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 InOrder //creates the InOrder class | |
{ | |
private int numOne; //creates the instance variable numOne | |
private int numTwo; //creates the instance variable numTwo | |
private int numThree; //creates the instance variable numThree | |
boolean b = false; //creates the boolean value b (not instance) | |
public InOrder() //default constructor | |
{ //assigns default values to instance variables | |
numOne = 0; |
OlderNewer