Skip to content

Instantly share code, notes, and snippets.

@jimmykurian
jimmykurian / BarChart.java
Created February 18, 2012 02:25
A Java program that displays a bar chart of the added values.
//BarChart.java - Jimmy Kurian
import java.util.ArrayList;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.Rectangle;
public class BarChart
{
@jimmykurian
jimmykurian / Square.java
Created February 18, 2012 01:57
A Java program that reads in n^2 values from the keyboard and test whether they form a magic square when arranged as a square matrix.
//Square.java - Jimmy Kurian
import java.util.Scanner;
public class Square
{
//Constructs a n x n square filled with zeros.
public Square(int n)
{
@jimmykurian
jimmykurian / HelloWolrd.pl
Created February 17, 2012 18:30
A simple Hello World written in GNU Prolog implementation of the Prolog logic based programming language.
%HelloWorld.pl - Jimmy Kurian
write('Hello, World!'), nl.
@jimmykurian
jimmykurian / HelloWorld.scm
Created February 17, 2012 18:09
A simple Hello World program written in the Scheme programming language.
;HelloWorld.scm - Jimmy Kurian
(begin
(display "Hello, World!")
(newline))
@jimmykurian
jimmykurian / FileIO.rb
Created February 6, 2012 17:01
Basic File I/O program, written in Ruby.
# FileIO.rb - Jimmy Kurian
print "Please enter a past-tense verb: "
verb = gets.chomp
print "Please enter a noun: "
noun = gets.chomp
print "Please enter a proper noun: "
prop_noun = gets.chomp
print "Please enter a an adverb: "
adv = gets.chomp
@jimmykurian
jimmykurian / BasicIO.rb
Created February 6, 2012 16:59
A basic I/O program written in Ruby.
# BasicIO.rb - Jimmy Kurian
print "Please enter a past-tense verb: "
verb = gets.chomp
print "Please enter a noun: "
noun = gets.chomp
print "Please enter a proper noun: "
prop_noun = gets.chomp
print "Please enter a an adverb: "
adv = gets.chomp
@jimmykurian
jimmykurian / Car.trc
Created February 6, 2012 16:47
Simple animation program written in TrueBASIC.
!Car.trc - Jimmy Kurian
SET WINDOW 0,20,0,20
SET COLOR 5
BOX AREA 2,6,2,3
BOX AREA 9,13,2,3
BOX AREA 16,20,2,3
SET COLOR 249
PLOT LINES :0,5;20,5
FLOOD 10,1
@jimmykurian
jimmykurian / BankAccount.py
Created February 6, 2012 16:41
A BankAccount program with classes, written in Python.
# BankAccount.py - Jimmy Kurian
class BankAccount(object):
def __init__(self, initial_balance=0):
self.balance = initial_balance
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
self.balance -= amount
def overdrawn(self):
@jimmykurian
jimmykurian / RegularExpressions.py
Created February 6, 2012 16:39
A Python program, that tests regular expressions.
#RegularExpressions.py - Jimmy Kurian
import re
for test_string in ['555-1212', 'ILL-EGAL']:
if re.match(r'^\d{3}-\d{4}$', test_string):
print test_string, 'is a valid US local phone number'
else:
print test_string, 'rejected'
@jimmykurian
jimmykurian / CheckerBoard.java
Created February 3, 2012 22:12
A graphical application that displays a 8x8 chess board with 64 squares, alternating black and white.
//CheckerBoard.java - Jimmy Kurian
import javax.swing.*;
import java.awt.Graphics;
import java.awt.Color;
public class CheckerBoard extends JFrame
{
public void paint(Graphics g)