Skip to content

Instantly share code, notes, and snippets.

@jimmykurian
jimmykurian / ArrayListImp.java
Created May 4, 2012 20:31
A java program that contains implementations of the ArrayList and LinkedList classes and various custom written methods.
//ArrayListImp.java - Jimmy Kurian
import java.util.Iterator;
public class ArrayListImp<E>
{
private E [ ] items;
private int capacity = 2;
private int size = 0;
@jimmykurian
jimmykurian / HelloWorld.cs
Created May 4, 2012 20:27
A simple Hello Wolrd program written in C#.
// HelloWorld.cs - Jimmy Kurian
using System;
public class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello, World!");
}
}
@jimmykurian
jimmykurian / Employee.java
Created April 21, 2012 22:43
A simple Java program to keep track of employees in a company which implements HashMap and TreeSet data sructures.
//Employee.java - Jimmy Kurian
public class Employee implements Comparable<Employee>
{
private String ssn;
private String lastName;
private String firstName;
public int compareTo(Employee emp)
@jimmykurian
jimmykurian / Postal.java
Created April 7, 2012 01:19
A Java program that asks the user for a ZIP code and prints the bar code. Also translates bars into their ZIP code, reporting any errors in the input format or a mismatch of digits.
//Postal.java - Jimmy Kurian
import java.util.Scanner;
public class Postal
{
public int num2; // 10000 digit
public int num3; // 1000 digit
public int num4; // 100 digit
public int num5; // 10 digit
@jimmykurian
jimmykurian / Instructor.java
Created March 13, 2012 05:27
A super class Person with two subclasses, Student and Instructor, that inherit from Person. A person has a name and a year of birth. A student has a major, and an instructor has a salary.
//Instructor.java - Jimmy Kurian
public class Instructor extends Person
{
private double salary;
public Instructor(String n, int byear, double s)
{
super(n, byear);
salary = s;
@jimmykurian
jimmykurian / ButtonViewer.java
Created March 13, 2012 05:24
A Java program that has two buttons, each of which prints a message “I was clicked n time!” whenever the button is clicked. Each button has a separate click count.
//ButtonViewer.java - Jimmy Kurian
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class ButtonViewer
{
@jimmykurian
jimmykurian / DataSet.java
Created March 13, 2012 05:21
A modified version of the DataSet class that accepts Comparable objects.
//DataSet.java - Jimmy Kurian
public class DataSet
{
private Comparable minimum;
private Comparable maximum;
public DataSet()
{
maximum = null;
@jimmykurian
jimmykurian / BankAccount.java
Created March 13, 2012 05:18
A modified implementation of the DataSet class to use both a Measurer and a Filter object.
//BankAccount.java - Jimmy Kurian
public class BankAccount
{
private double balance;
public BankAccount()
{
balance = 0;
}
@jimmykurian
jimmykurian / Cone.java
Created February 21, 2012 05:41
An object oriented version of Geometry.java that will compute the volume and surface area of a sphere with radius r, a cylinder with circular base with radius r and height h, and a cone with circular base with radius r and height h. Written in Java.
//Cone.java - Jimmy Kurian
public class Cone
{
private double r;
private double h;
public Cone(double aRadius, double aHeight)
{
r = aRadius;
@jimmykurian
jimmykurian / Geometry.java
Created February 21, 2012 05:38
A Java program that will compute the volume and surface area of a sphere with radius r, a cylinder with circular base with radius r and height h, and a cone with circular base with radius r and height h.
//Geometry.java - Jimmy Kurian
public class Geometry
{
public static double sphereVolume(double r)
{
return (4.0 / 3.0) * Math.PI * r * r * r;
}