Skip to content

Instantly share code, notes, and snippets.

View kenechiokolo's full-sized avatar

KC Okolo kenechiokolo

View GitHub Profile
@kenechiokolo
kenechiokolo / gist:140041c53ee771fbd4f5
Created March 10, 2015 13:45
Section Assignment 1: Defend Democracy Karel
import stanford.karel.SuperKarel;
public class defendDemocracyKarel extends SuperKarel {
/* This program is designed to clean the ballots in Karel's world. If there is no
* beeper in the centre, this indicates voter intent
* and Karel clears that whole column.
*/
public void run() {
while (frontIsClear()) {
move();
@kenechiokolo
kenechiokolo / Pyramid
Created March 14, 2015 13:18
Programming Methodology CS106A: Assignment 2.1
/*
* File: Pyramid.java
* Name:
* Section Leader:
* ------------------
* This file is the starter file for the Pyramid problem.
* It includes definitions of the constants that match the
* sample run in the assignment, but you should make sure
* that changing these values causes the generated display
* to change accordingly.
@kenechiokolo
kenechiokolo / CS106A: Assignment 2.2
Created March 14, 2015 14:36
CS106A: Assignment 2.2
/*
* File: Target.java
* Name:
* Section Leader:
* -----------------
* This file is the starter file for the Target problem.
*/
import acm.graphics.*;
import acm.program.*;
@kenechiokolo
kenechiokolo / Program Hierarchy
Created March 16, 2015 12:42
CS106A: Assignment 2.3
/*
* File: ProgramHierarchy.java
* Name:
* Section Leader:
* ---------------------------
* This file is the starter file for the ProgramHierarchy problem.
*/
import acm.graphics.*;
import acm.program.*;
@kenechiokolo
kenechiokolo / Pythagorean Theorem
Created March 16, 2015 14:19
CS106A: Assignment 2.4
/*
* File: PythagoreanTheorem.java
* Name:
* Section Leader:
* -----------------------------
* This file is the starter file for the PythagoreanTheorem problem.
*/
import acm.program.*;
@kenechiokolo
kenechiokolo / FindRange
Created March 16, 2015 18:56
CS106A: Assignment 2.5
/*
* File: FindRange.java
* Name:
* Section Leader:
* --------------------
* This file is the starter file for the FindRange problem.
*/
import acm.program.*;
@kenechiokolo
kenechiokolo / Hailstone
Created March 17, 2015 09:04
CS106A: Assignment 2.6 - Hailstone Sequence
/*
* File: Hailstone.java
* Name:
* Section Leader:
* --------------------
* This file is the starter file for the Hailstone problem.
*/
import acm.program.*;
@kenechiokolo
kenechiokolo / Fibonacci Sequence
Created March 23, 2015 12:24
CS106A Section Assignment 2: The Fibonacci Sequence
import acm.program.*;
// this program prints the fibonacci sequence
public class sectionAssignment_2 extends ConsoleProgram {
// specifies max value for term in fibonacci sequence
private static final int MAX_TERM_VALUE = 10000;
public void run() {
introduction();
@kenechiokolo
kenechiokolo / Robot Face
Created March 23, 2015 16:55
CS106A Section Assignment 2.2
import acm.graphics.*;
import acm.program.*;
import java.awt.*;
public class robotFace extends GraphicsProgram {
private static final double HEAD_WIDTH = 200;
private static final double HEAD_HEIGHT = 350;
private static final double EYE_RADIUS = 30;
private static final double MOUTH_WIDTH = 110;
@kenechiokolo
kenechiokolo / Random Circles
Created March 30, 2015 18:59
CS106A Assignment 3.2
import acm.graphics.*;
import acm.program.*;
import acm.util.*;
public class randomCircles extends GraphicsProgram {
// specifies number of circles
private static final int NCIRCLES = 10;
// specifies minimum radius
private static final int RMIN = 5;