diff --git a/planet-express/java/.classpath b/planet-express/java/.classpath new file mode 100644 index 0000000..fb50116 --- /dev/null +++ b/planet-express/java/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/planet-express/java/.gitignore b/planet-express/java/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/planet-express/java/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/planet-express/java/.project b/planet-express/java/.project new file mode 100644 index 0000000..addd00c --- /dev/null +++ b/planet-express/java/.project @@ -0,0 +1,17 @@ + + + planet-express + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/planet-express/java/src/Crew.class b/planet-express/java/src/Crew.class new file mode 100644 index 0000000..c134509 Binary files /dev/null and b/planet-express/java/src/Crew.class differ diff --git a/planet-express/java/src/Crew.java b/planet-express/java/src/Crew.java new file mode 100644 index 0000000..aaa2d00 --- /dev/null +++ b/planet-express/java/src/Crew.java @@ -0,0 +1,74 @@ + +public class Crew { + int thirst = 50; + int work = 50; + int horde = 50; + int hunger = 50; + int receipts = 50; + boolean stable = true; + int score = 50; + + public void drink() { + thirst -= 5; + work += 5; + } + + public void deliver() { + work -= 5; + receipts += 5; + } + + public void steal() { + horde += 5; + work += 5; + } + + public void eat() { + hunger -= 5; + work += 5; + } + + public void account() { + receipts -= 5; + horde -= 5; + } + + public int score() { + if (thirst >= 100 || work >= 100 || horde <= 0 || hunger >= 100 || receipts <= 0) { + score = 0; + } + return score; + } + + public boolean check() { + if (score <= 0) { + stable = false; + return false; + } + else { + if (thirst >= 85) { + System.out.println("Fry is scary-thirsty!"); + } + + if (work >= 85) { + System.out.println("Leela is exhausted from all this work!"); + } + + if (horde <= 15) { + System.out.println("Bender is sad because he doesn't have enough treasure!"); + } + + if (hunger >= 85) { + System.out.println("Zoidberg is going to eat something and it's not going to be pretty!"); + } + + if (receipts <= 15) { + System.out.println("Hermes doesn't have enough receipts!"); + } + + return true; + } + + } + +} diff --git a/planet-express/java/src/Program.class b/planet-express/java/src/Program.class new file mode 100644 index 0000000..7d21813 Binary files /dev/null and b/planet-express/java/src/Program.class differ diff --git a/planet-express/java/src/Program.java b/planet-express/java/src/Program.java new file mode 100644 index 0000000..1506170 --- /dev/null +++ b/planet-express/java/src/Program.java @@ -0,0 +1,20 @@ +class Program { + + public static void main (String[] args) { + Crew spaceship = new Crew(); + System.out.println(spaceship.check()); + System.out.println(spaceship.work); + for (int i = 0; i < 7; i++) { + spaceship.drink(); + } + System.out.println(spaceship.work); + System.out.println(spaceship.check()); + for (int j = 0; j < 3; j++) { + spaceship.drink(); + } + System.out.println(spaceship.work); + System.out.println(spaceship.score()); + System.out.println(spaceship.check()); + } + +} \ No newline at end of file diff --git a/planet-express/python/crew.py b/planet-express/python/crew.py new file mode 100644 index 0000000..334c140 --- /dev/null +++ b/planet-express/python/crew.py @@ -0,0 +1,60 @@ +class Crew: + 'defines some properties about the crew of the spaceship' + + def __init__(self): + self.thirst = 50 + self.work = 50 + self.horde = 50 + self.hunger = 50 + self.receipts = 50 + self.stable = True + self.score = 50 + + def drink(self): + self.thirst -= 5 + self.work += 5 + + def deliver(self): + self.work -= 5 + self.receipts += 5 + + def steal(self): + self.horde += 5 + self.work += 5 + + def eat(self): + self.hunger -= 5 + self.work += 5 + + def account(self): + self.receipts -= 5 + self.horde -= 5 + + def current_score(self): + if self.thirst >= 100 or self.work >= 100 or self.horde <= 0 or self.hunger >= 100 or self.receipts <= 0: + self.score = 0 + return self.score + + def check(self): + # if score is too low, end the game + if self.score <= 0: + self.stable = False + return False + else: + # check to see if you need to print warnings + if self.thirst >= 85: + print "Fry is scary thirsty!" + + if self.work >= 85: + print "Leela is exhausted from all this work!" + + if self.horde <= 15: + print "Bender is sad because he doesn't have enough treasure!" + + if self.hunger >= 85: + print "Zoidberg is going to eat something and it's not going to be pretty!" + + if self.receipts <= 15: + print "Hermes doesn't have enough receipts!" + + return True diff --git a/planet-express/python/crew.pyc b/planet-express/python/crew.pyc new file mode 100644 index 0000000..cf174be Binary files /dev/null and b/planet-express/python/crew.pyc differ diff --git a/planet-express/python/program.py b/planet-express/python/program.py new file mode 100644 index 0000000..d9f610d --- /dev/null +++ b/planet-express/python/program.py @@ -0,0 +1,15 @@ +import crew + +spaceship = crew.Crew() + +print spaceship.check() +print spaceship.work +for i in range(0,7): + spaceship.drink() +print spaceship.work +print spaceship.check() +for j in range(0,3): + spaceship.drink() +print spaceship.work +print spaceship.current_score() +print spaceship.check() diff --git a/planet-express/ruby/crew.rb b/planet-express/ruby/crew.rb new file mode 100644 index 0000000..d70e689 --- /dev/null +++ b/planet-express/ruby/crew.rb @@ -0,0 +1,76 @@ +class Crew + attr_accessor :thirst, :work, :horde, :hunger, :receipts, :stable + + def initialize + @thirst = 50 + @work = 50 + @horde = 50 + @hunger = 50 + @receipts = 50 + @stable = true + @score = 50 + end + + def drink + @thirst -= 5 + @work += 5 + end + + def deliver + @work -= 5 + @receipts += 5 + end + + def steal + @horde += 5 + @work += 5 + end + + def eat + @hunger -= 5 + @work += 5 + end + + def account + @receipts -= 5 + @horde -= 5 + end + + def score + if @thirst >= 100 || @work >= 100 || @horde <= 0 || @hunger >= 100 || @receipts <= 0 + @score = 0 + end + end + + def check + # if score is too low, end game + if @score <= 0 + @stable = false + return false + else + # check to see if you need to print warnings + if @thirst >= 85 + puts "Fry is scary-thirsty!" + end + + if @work >= 85 + puts "Leela is exhausted from all this work!" + end + + if @horde <= 15 + puts "Bender is sad because he doesn't have enough treasure!" + end + + if @hunger >= 85 + puts "Zoidberg is going to eat something and it's not going to be pretty!" + end + + if @receipts <= 15 + puts "Hermes doesn't have enough receipts!" + end + + return true + end + end + +end diff --git a/planet-express/ruby/program.rb b/planet-express/ruby/program.rb new file mode 100644 index 0000000..349656a --- /dev/null +++ b/planet-express/ruby/program.rb @@ -0,0 +1,17 @@ +require "./crew.rb" + +spaceship = Crew.new + +puts spaceship.check +puts spaceship.work +7.times do + spaceship.drink +end +puts spaceship.work +puts spaceship.check +3.times do + spaceship.drink +end +puts spaceship.work +puts spaceship.score +puts spaceship.check