Skip to content

Instantly share code, notes, and snippets.

import java.util.Scanner;
/**
* Created by Connor on 10/5/15.
*/
public class RomanNumbers {
public int input;
//parametrized constructor
@connlark
connlark / Primes.java
Created October 21, 2015 21:23
Recall that a prime number is an integer > 1 whose only factors are 1 and itself. Create a class called Primes which will contain a class method called isPrime(int p) which determines if an integer p is a prime number. Assume p > 1. Write this method without using any methods from the Math class. All methods should be written as class methods us…
/**
* Created by Connor on 10/19/15.
*/
public class Primes {
//class method called isPrime(int p) which determines if an integer p is a prime number. Assume p > 1.
public static boolean isPrime(int p) {
if (p <= 1) return false;
if (p == 2) return true;
/**
* Created by Connor on 10/19/15.
*/
public class Primes {
/** class method called isPrime(int p) which determines if an integer p is a prime number. Assume p > 1. */
public static boolean isPrime(int p) {
if (p <= 1) return false;
if (p == 2) return true;
//check if n is a multiple of 2
/**
* Created by Connor on 10/30/15.
*/
public class Ch6Hw8 {
public static void printV(int height) {
int width = (height * 2) - 1;
int farV = width;
for (int i = 1; i <= height; i++, farV--) {
for (int j = 1; j <= width; j++) {
@connlark
connlark / MyArt.java
Last active November 16, 2015 04:15
for the grags out there
/**
* Created by Connor on 11/4/15.
*/
public class MyArt {
private Picture image;
/**
* Create an Art object using the jpg or bmp at the indicated location
*/
public MyArt(String filename)
import java.util.*;
/**
* Created by Connor on 11/19/15.
*/
public class Histogram {
private int [] values;
private int interval;
public Histogram(){
values = new int[100];
import java.util.ArrayList;
import java.util.Scanner;
public class MyPlaces
{
/**
* Instance variable: a collection which is
* always in alphabetic order
*/
private ArrayList<String> places;
@connlark
connlark / Rack.java
Last active December 9, 2015 15:25
That rack tho ;)
/**
* Created by Connor on 12/8/15.
*/
public class Rack {
private Vial[][] rack;
public Rack(){
rack = new Vial[3][8]; //instantiates the rack when object is created
}
/**
* Created by Connor on 1/21/16.
*/
public interface Information {
public int getLength();
public String getName();
}
@connlark
connlark / Information.java
Created February 2, 2016 03:03
Updated 2/1
/**
* Created by Connor on 1/21/16.
*/
public interface Information {
public int getLength();
public String getName();
}
//TODO: this less than other == -1 this greater than other == 1 else 0