Skip to content

Instantly share code, notes, and snippets.

View mattcunningham's full-sized avatar

Matthew Cunningham mattcunningham

View GitHub Profile
package main
import (
"fmt"
"reflect"
"net/url"
)
type ExampleType struct {
Name string `url:"name"`
@mattcunningham
mattcunningham / 12.1.java
Last active January 10, 2017 18:00
Chapter 12
public class StringOps {
private String[] words;
public StringOps(String[] wordStrings){
words = wordStrings;
}
public String stringHalf(boolean firstHalf) {
String finalString = "";
for (String word : words) {
public class ArrayMadness {
public static int findMax(int [] numbersArray) {
int max = numbersArray[0];
for (int number : numbersArray) {
if (number > max) {
max = number;
}
}
return max;
}
public class ArrayChecker {
private int[][] testNums;
public ArrayChecker(int[][] testNums) {
this.testNums = testNums;
}
public int arrayInstance(int instance) {
int instances = 0;
for (int[] testNum : testNums) {
import java.util.ArrayList;
public class BaseballPlayer {
public ArrayList<Integer> playerStats;
public BaseballPlayer(int numHits, int numRuns, int numRBIs) {
playerStats = new ArrayList<Integer>();
playerStats.add(numHits);
playerStats.add(numRuns);
playerStats.add(numRBIs);
public class FlipFlop {
public static String findFlipFlop(int testNm) {
String retString = "";
for (int i = 1; i <= testNm; i++) {
boolean three = i % 3 == 0;
boolean five = i % 5 == 0;
if (three || five) {
if (three) {
retString += "Flip";
}
import java.util.List;
import java.util.ArrayList;
public class MasterSubscription {
private List<MagazineOrder> orders;
public MasterSubscription() {
orders = new ArrayList<MagazineOrder>();
}
public class Tabby extends Cat {
public String meow() {
return "meow meow";
}
}
public class Siamese extends Cat {
public String meow() {
return "if you please";
}
@mattcunningham
mattcunningham / 5.13.java
Created February 14, 2017 18:37
5.13 Program: Soccer team roster (Java)
import java.util.Scanner;
public class PlayerRoster {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int[][] players = new int[5][2];
boolean keepAlive = true;
char input;
for (int i = 0; i < 5; i++) {