This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TaxCalculator implements TaxLookup | |
{ | |
public static double getTax(int income, int status) | |
{ | |
double tax = 0; | |
for (int i = 0; i < 7; i++) | |
{ | |
if (income > lookup[status][i][1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package philyboyd_studge; | |
public class MinecraftChallenge { | |
public static void main(String[] args) { | |
World world = new World(); | |
world.updateWorld(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class Game21 | |
{ | |
private int[] heap; | |
private Random rand = new Random(); | |
private boolean computerOpponent; | |
private boolean lastPlayWins; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Inventory implements Comparable<Inventory> | |
{ | |
private String item; | |
private int qty; | |
private float price; | |
public Inventory(String item, int qty, float price) | |
{ | |
this.item = item; | |
this.qty = qty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generic Self-Balancing Key-Value Binary Search Tree | |
for /r/javaexamples | |
by /u/Philboyd_Studge | |
*/ | |
import java.util.Queue; | |
import java.util.LinkedList; | |
import java.util.List; | |
@SuppressWarnings("unchecked") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Inventory class | |
* for /r/javaexamples | |
* by /u/Philboyd_Studge | |
* | |
*/ | |
package philboyd.studge; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.util.Random; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generic Min/Max Binary Heap | |
* for /r/javaexamples | |
* | |
*/ | |
import java.util.Arrays; | |
@SuppressWarnings("unchecked") | |
/** | |
* Creates an array-based binary heap. Defaults to 'min' (Priority Queue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generic Directed Weighted Graph with Dijkstra's Shortest Path Algorithm | |
* by /u/Philboyd_Studge | |
* for /r/javaexamples | |
*/ | |
import java.util.List; | |
import java.util.Queue; | |
import java.util.PriorityQueue; | |
import java.util.Deque; | |
import java.util.LinkedList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Generic Top-Down Merge Sort | |
* Based on this | |
* https://en.wikipedia.org/wiki/Merge_sort#Top-down_implementation_using_lists | |
* | |
* for http://www.reddit.com/r/javaexamples | |
* by user /u/Philboyd_Studge | |
* | |
* PUBLIC LICENSE - This software is released with an unlimited license. | |
* There is no specification of any kind on its usage or implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. |
OlderNewer