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
abstract class Pokemon extends GameObject{ | |
int currentHP; | |
int maxHP; | |
PImage leftImg, rightImg; | |
float yVel; | |
float GRAV = .5; | |
float xVel; | |
float xAcc; | |
void moveRight() { |
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
// Notice: the Node should have a toString() method | |
// which returns the <content> instance variable | |
void setup() { | |
Node a = new Node("123"); | |
Node b = new Node("456"); | |
Node c = new Node("789"); | |
Stack s = new Stack(); | |
s.push(a); |
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
String alphabet = "abcdefghijklmnopqrstuvwxyz"; | |
void setup() { | |
String plaintext = "happy monday, everyone!"; | |
String ciphertext = encrypt(plaintext, 1); | |
println(ciphertext); | |
} | |
void draw() { | |
} |
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
float startAngle; | |
float angleVel; | |
float amp; | |
void setup() { | |
startAngle = 0; | |
angleVel = 0.4; | |
amp = 100; | |
size(500, 500); | |
} |
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
void setup() { | |
size(500, 500); | |
} | |
void draw() { | |
background(255); | |
float period = 50; | |
float amplitude = 200; | |
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
Train t; | |
void setup() { | |
t = new Train(); | |
size(500, 500); | |
} | |
void draw() { | |
background(255); | |
t.update(); |
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 Race { | |
public static void main(String[] args) { | |
Race r = new Race(); | |
try { | |
r.beginRace(); | |
} catch (InterruptedException e) { | |
System.out.println("Unable to execute race..."); | |
} | |
System.out.println(rt.getWinnersList()); |
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
interface Racer { | |
boolean crossedFinishLine(); | |
void tick(); | |
void setTrack(String[] t); | |
int getTrackLength(); | |
int getPositionOnTrack(); | |
int getMaxSpeed(); | |
int getMaxHandling(); | |
} |
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 Register { | |
public static void main(String[] args) { | |
System.out.println("Welcome to the cash register!"); | |
double cost = 9.76; | |
double totalPaid = 20.00; | |
double change = totalPaid - cost; | |
int dollars = (int) Math.floor(change); |
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 Reverser { | |
public static void main(String[] args) { | |
String input = "1 2 3"; | |
String output = ""; | |
System.out.println("Input :: "+input); | |
while (input.length() > 0) { | |
String element = input.substring(input.length() - 1, input.length()); | |
output += element; | |
input = input.substring(0, input.length() - 1); |
NewerOlder