Skip to content

Instantly share code, notes, and snippets.

@borncorp
borncorp / Servlet.java
Created July 23, 2014 00:51
Basic Servlet that sums 2 integers
package servletPackage;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
package com.borncorp.IntroServlet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
@borncorp
borncorp / SearchAndReplace.java
Created July 2, 2014 07:10
Writes to a file, reads from a file, and searches and replaces words in the file and rewrites to the file.
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Random;
public class Match {
private Team team1;
private Team team2;
private Team winner;
public Match(Team team1, Team team2) {
super();
@borncorp
borncorp / Main
Created June 27, 2014 05:54
Shape Lab
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
//Create ArrayList of Shapes
ArrayList<Shape> myShapes=new ArrayList<Shape>();
@borncorp
borncorp / CookieStorePseudocode
Last active August 29, 2015 14:02
Cookie Store Pseudocode
Have the customers select amount of cookies/cake/toppings etc..
Bring items to the cash register and ask to lookup his phone number on FB Database (if existing).
If customer doesnt have FB Account then store gives customer the choice to create an account or continue without.
If customer chooses to create an account then store creates an account asking the customer's phone#.
Store has to calculate the total.
If customer has FB Account.
Store has to validate the FB Account with the customer's phone#.
@borncorp
borncorp / ArrayLists
Created June 19, 2014 06:28
ArrayLists Cookie
import java.util.ArrayList;
public class ArrayLists {
public static void main(String[] args) {
Cookie myCookie= new Cookie("Oatmeal", 1);
ArrayList<Topping> myToppings= new ArrayList<Topping>();
Topping raisin= new Topping("Raisin", "Red");
@borncorp
borncorp / Bottle
Last active August 29, 2015 14:02
SettersnGetters
public class Bottle {
String name;
int capacity;
int used;
String contains;
String color;
public Bottle(String namecopy, int capacitycopy, int usedcopy, String containscopy, String colorcopy) {
this.name=namecopy;
@borncorp
borncorp / Bottle
Last active August 29, 2015 14:02
public class Bottle {
int capacity;
int used;
String contains;
String color;
public Bottle(int capacitycopy, int usedcopy, String containscopy, String colorcopy) {
this.capacity=capacitycopy;
this.used=usedcopy;