Skip to content

Instantly share code, notes, and snippets.

@NatashaTheRobot
NatashaTheRobot / FibonacciSequenceSolution
Created November 2, 2011 20:18
This is the solution to the Fibonacci Sequence problem from Section Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* This is the solution to the Section Handout #2 from the
* Stanford CS106A online class
*/
import acm.program.*;
public class FibonacciSequence extends ConsoleProgram {
private static final int MAX_TERM_VALUE = 10000;
@NatashaTheRobot
NatashaTheRobot / HailstoneSolution
Created November 2, 2011 01:46
This is the solution to the Hailstone problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: Hailstone.java
* Name:
* Section Leader:
* --------------------
* This file is the starter file for the Hailstone problem.
*/
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / FindRangeSolution
Created November 2, 2011 00:19
This is the solution to the Find Range problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: FindRange.java
* Name:
* Section Leader:
* --------------------
* This file is the starter file for the FindRange problem.
*/
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / ProgrammingHierarchySolution
Created November 1, 2011 05:35
This is the solution to the Programming Hierarchy problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: ProgramHierarchy.java
* Name:
* Section Leader:
* ---------------------------
* This file is the starter file for the ProgramHierarchy problem.
*/
import acm.graphics.*;
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / PythagoreanTheoremSolution
Created November 1, 2011 01:18
This is the solution to the Pythagorean Theorem problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: PythagoreanTheorem.java
* Name:
* Section Leader:
* -----------------------------
* This file is the starter file for the PythagoreanTheorem problem.
*/
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / PyramidSolution
Created November 1, 2011 00:23
This is the solution to the Pyramid problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* 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.
@NatashaTheRobot
NatashaTheRobot / Target
Created October 31, 2011 19:41
This is the solution to the Target problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: Target.java
* Name:
* Section Leader:
* -----------------
* This file is the starter file for the Target problem.
*/
import acm.graphics.*;
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / KarelDefendsDemocracy
Created October 31, 2011 01:27
This is the solution to the Karel Defends Democracy Stanford 106A Section Problem
/* Karel is cleaning up the voting ballot.
* The vote only counts if the middle rectangle is punched,
* which means there are no beepers present.
*/
import stanford.karel.SuperKarel;
public class defendDemocracyKarel extends SuperKarel {
public void run() {
@NatashaTheRobot
NatashaTheRobot / CollectNewspaperKarel Solution
Created October 28, 2011 04:33
This is the solution to the CollectNewspaperKarel problem in the online Stanford CS 106A class
/*
* File: CollectNewspaperKarel.java
* --------------------------------
* At present, the CollectNewspaperKarel subclass does nothing.
* Your job in the assignment is to add the necessary code to
* instruct Karel to walk to the door of its house, pick up the
* newspaper (represented by a beeper, of course), and then return
* to its initial position in the upper left corner of the house.
*/
@NatashaTheRobot
NatashaTheRobot / StoneMason Karel Solution
Created October 28, 2011 04:22
This is the solution to the StoneMasonKarel problem in the online Stanford CS 106A class
/*
* File: StoneMasonKarel.java
* --------------------------
* The StoneMasonKarel subclass as it appears here does nothing.
* When you finish writing it, it should solve the "repair the quad"
* problem from Assignment 1. In addition to editing the program,
* you should be sure to edit this comment so that it no longer
* indicates that the program does nothing.
*/