diff --git a/Cow.java b/Cow.java new file mode 100755 index 0000000..7743d25 --- /dev/null +++ b/Cow.java @@ -0,0 +1,90 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This file holds the cow class and associated methods. + */ + +public class Cow +{ + private static int idCounter = 1; + + private int id; + private String name; + private String sex; + private int milk, strength, meat, aggression; + + public Cow(String desiredSex) + { + //Default cow/bull + sex = desiredSex; + id = idCounter; + idCounter++; + name = makeName(sex, id); + milk = 1; + strength = 5; + meat = 1; + aggression = 10; + } + + public Cow(Cow father, Cow mother) + { + //Constructor used for reproduction + //TODO + } + + public String rateCow(Cow c, String use) + { + int rating = 0; + if (use == "dairy") { + rating = rateDairyCow(c); + } + else if (use == "plowing") { + rating = ratePlowCow(c); + } + else if (use == "meat") { + rating = rateMeatCow(c); + } + else { + //error + } + return "This is a "+rating2string(rating)+" cow for "+use+"."; + } + + private int rateDairyCow(Cow c) + { + //TODO + } + + private int rateMeatCow(Cow c) + { + //TODO + } + + private int ratePlowCow(Cow c) + { + //TODO + } + + /* + * Return a string rating for values between 0 and 20. + */ + private String rating2String(int rating) + { + if (rating < 1) return "useless"; + else if (rating < 3) return "terrible"; + else if (rating < 6) return "pretty bad"; + else if (rating < 9) return "moderate"; + else if (rating < 12) return "passable"; + else if (rating < 15) return "fairly good"; + else if (rating < 18) return "pretty good"; + else if (rating < 20) return "very good"; + else return "brilliant"; + } + +} diff --git a/Cow.java b/Cow.java new file mode 100755 index 0000000..7743d25 --- /dev/null +++ b/Cow.java @@ -0,0 +1,90 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This file holds the cow class and associated methods. + */ + +public class Cow +{ + private static int idCounter = 1; + + private int id; + private String name; + private String sex; + private int milk, strength, meat, aggression; + + public Cow(String desiredSex) + { + //Default cow/bull + sex = desiredSex; + id = idCounter; + idCounter++; + name = makeName(sex, id); + milk = 1; + strength = 5; + meat = 1; + aggression = 10; + } + + public Cow(Cow father, Cow mother) + { + //Constructor used for reproduction + //TODO + } + + public String rateCow(Cow c, String use) + { + int rating = 0; + if (use == "dairy") { + rating = rateDairyCow(c); + } + else if (use == "plowing") { + rating = ratePlowCow(c); + } + else if (use == "meat") { + rating = rateMeatCow(c); + } + else { + //error + } + return "This is a "+rating2string(rating)+" cow for "+use+"."; + } + + private int rateDairyCow(Cow c) + { + //TODO + } + + private int rateMeatCow(Cow c) + { + //TODO + } + + private int ratePlowCow(Cow c) + { + //TODO + } + + /* + * Return a string rating for values between 0 and 20. + */ + private String rating2String(int rating) + { + if (rating < 1) return "useless"; + else if (rating < 3) return "terrible"; + else if (rating < 6) return "pretty bad"; + else if (rating < 9) return "moderate"; + else if (rating < 12) return "passable"; + else if (rating < 15) return "fairly good"; + else if (rating < 18) return "pretty good"; + else if (rating < 20) return "very good"; + else return "brilliant"; + } + +} diff --git a/MooBreeder.java b/MooBreeder.java new file mode 100755 index 0000000..cbb7a55 --- /dev/null +++ b/MooBreeder.java @@ -0,0 +1,36 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This is the main class with the GUI. + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.ArrayList; + +import Cow; + +public class MooBreeder extends JFrame +{ + private JMenuBar menubar; + private JMenu file, help; + private JMenuItem reset, quit, help, about; + private Box herdBox, parentBox, offspringBox; + + public static void main(String[] args) + { + //TODO + } + + public MooBreeder() + { + //TODO + } +} diff --git a/Cow.java b/Cow.java new file mode 100755 index 0000000..7743d25 --- /dev/null +++ b/Cow.java @@ -0,0 +1,90 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This file holds the cow class and associated methods. + */ + +public class Cow +{ + private static int idCounter = 1; + + private int id; + private String name; + private String sex; + private int milk, strength, meat, aggression; + + public Cow(String desiredSex) + { + //Default cow/bull + sex = desiredSex; + id = idCounter; + idCounter++; + name = makeName(sex, id); + milk = 1; + strength = 5; + meat = 1; + aggression = 10; + } + + public Cow(Cow father, Cow mother) + { + //Constructor used for reproduction + //TODO + } + + public String rateCow(Cow c, String use) + { + int rating = 0; + if (use == "dairy") { + rating = rateDairyCow(c); + } + else if (use == "plowing") { + rating = ratePlowCow(c); + } + else if (use == "meat") { + rating = rateMeatCow(c); + } + else { + //error + } + return "This is a "+rating2string(rating)+" cow for "+use+"."; + } + + private int rateDairyCow(Cow c) + { + //TODO + } + + private int rateMeatCow(Cow c) + { + //TODO + } + + private int ratePlowCow(Cow c) + { + //TODO + } + + /* + * Return a string rating for values between 0 and 20. + */ + private String rating2String(int rating) + { + if (rating < 1) return "useless"; + else if (rating < 3) return "terrible"; + else if (rating < 6) return "pretty bad"; + else if (rating < 9) return "moderate"; + else if (rating < 12) return "passable"; + else if (rating < 15) return "fairly good"; + else if (rating < 18) return "pretty good"; + else if (rating < 20) return "very good"; + else return "brilliant"; + } + +} diff --git a/MooBreeder.java b/MooBreeder.java new file mode 100755 index 0000000..cbb7a55 --- /dev/null +++ b/MooBreeder.java @@ -0,0 +1,36 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This is the main class with the GUI. + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.ArrayList; + +import Cow; + +public class MooBreeder extends JFrame +{ + private JMenuBar menubar; + private JMenu file, help; + private JMenuItem reset, quit, help, about; + private Box herdBox, parentBox, offspringBox; + + public static void main(String[] args) + { + //TODO + } + + public MooBreeder() + { + //TODO + } +} diff --git a/cow.java b/cow.java deleted file mode 100755 index 7743d25..0000000 --- a/cow.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Moobreeder is a simple cow breeding game to illustrate the principles of - * selective breeding to KS3 pupils. - * - * (c) Daniel Vedder 2018, - * Amano Christian School - */ - -/* - * This file holds the cow class and associated methods. - */ - -public class Cow -{ - private static int idCounter = 1; - - private int id; - private String name; - private String sex; - private int milk, strength, meat, aggression; - - public Cow(String desiredSex) - { - //Default cow/bull - sex = desiredSex; - id = idCounter; - idCounter++; - name = makeName(sex, id); - milk = 1; - strength = 5; - meat = 1; - aggression = 10; - } - - public Cow(Cow father, Cow mother) - { - //Constructor used for reproduction - //TODO - } - - public String rateCow(Cow c, String use) - { - int rating = 0; - if (use == "dairy") { - rating = rateDairyCow(c); - } - else if (use == "plowing") { - rating = ratePlowCow(c); - } - else if (use == "meat") { - rating = rateMeatCow(c); - } - else { - //error - } - return "This is a "+rating2string(rating)+" cow for "+use+"."; - } - - private int rateDairyCow(Cow c) - { - //TODO - } - - private int rateMeatCow(Cow c) - { - //TODO - } - - private int ratePlowCow(Cow c) - { - //TODO - } - - /* - * Return a string rating for values between 0 and 20. - */ - private String rating2String(int rating) - { - if (rating < 1) return "useless"; - else if (rating < 3) return "terrible"; - else if (rating < 6) return "pretty bad"; - else if (rating < 9) return "moderate"; - else if (rating < 12) return "passable"; - else if (rating < 15) return "fairly good"; - else if (rating < 18) return "pretty good"; - else if (rating < 20) return "very good"; - else return "brilliant"; - } - -} diff --git a/Cow.java b/Cow.java new file mode 100755 index 0000000..7743d25 --- /dev/null +++ b/Cow.java @@ -0,0 +1,90 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This file holds the cow class and associated methods. + */ + +public class Cow +{ + private static int idCounter = 1; + + private int id; + private String name; + private String sex; + private int milk, strength, meat, aggression; + + public Cow(String desiredSex) + { + //Default cow/bull + sex = desiredSex; + id = idCounter; + idCounter++; + name = makeName(sex, id); + milk = 1; + strength = 5; + meat = 1; + aggression = 10; + } + + public Cow(Cow father, Cow mother) + { + //Constructor used for reproduction + //TODO + } + + public String rateCow(Cow c, String use) + { + int rating = 0; + if (use == "dairy") { + rating = rateDairyCow(c); + } + else if (use == "plowing") { + rating = ratePlowCow(c); + } + else if (use == "meat") { + rating = rateMeatCow(c); + } + else { + //error + } + return "This is a "+rating2string(rating)+" cow for "+use+"."; + } + + private int rateDairyCow(Cow c) + { + //TODO + } + + private int rateMeatCow(Cow c) + { + //TODO + } + + private int ratePlowCow(Cow c) + { + //TODO + } + + /* + * Return a string rating for values between 0 and 20. + */ + private String rating2String(int rating) + { + if (rating < 1) return "useless"; + else if (rating < 3) return "terrible"; + else if (rating < 6) return "pretty bad"; + else if (rating < 9) return "moderate"; + else if (rating < 12) return "passable"; + else if (rating < 15) return "fairly good"; + else if (rating < 18) return "pretty good"; + else if (rating < 20) return "very good"; + else return "brilliant"; + } + +} diff --git a/MooBreeder.java b/MooBreeder.java new file mode 100755 index 0000000..cbb7a55 --- /dev/null +++ b/MooBreeder.java @@ -0,0 +1,36 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This is the main class with the GUI. + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.ArrayList; + +import Cow; + +public class MooBreeder extends JFrame +{ + private JMenuBar menubar; + private JMenu file, help; + private JMenuItem reset, quit, help, about; + private Box herdBox, parentBox, offspringBox; + + public static void main(String[] args) + { + //TODO + } + + public MooBreeder() + { + //TODO + } +} diff --git a/cow.java b/cow.java deleted file mode 100755 index 7743d25..0000000 --- a/cow.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Moobreeder is a simple cow breeding game to illustrate the principles of - * selective breeding to KS3 pupils. - * - * (c) Daniel Vedder 2018, - * Amano Christian School - */ - -/* - * This file holds the cow class and associated methods. - */ - -public class Cow -{ - private static int idCounter = 1; - - private int id; - private String name; - private String sex; - private int milk, strength, meat, aggression; - - public Cow(String desiredSex) - { - //Default cow/bull - sex = desiredSex; - id = idCounter; - idCounter++; - name = makeName(sex, id); - milk = 1; - strength = 5; - meat = 1; - aggression = 10; - } - - public Cow(Cow father, Cow mother) - { - //Constructor used for reproduction - //TODO - } - - public String rateCow(Cow c, String use) - { - int rating = 0; - if (use == "dairy") { - rating = rateDairyCow(c); - } - else if (use == "plowing") { - rating = ratePlowCow(c); - } - else if (use == "meat") { - rating = rateMeatCow(c); - } - else { - //error - } - return "This is a "+rating2string(rating)+" cow for "+use+"."; - } - - private int rateDairyCow(Cow c) - { - //TODO - } - - private int rateMeatCow(Cow c) - { - //TODO - } - - private int ratePlowCow(Cow c) - { - //TODO - } - - /* - * Return a string rating for values between 0 and 20. - */ - private String rating2String(int rating) - { - if (rating < 1) return "useless"; - else if (rating < 3) return "terrible"; - else if (rating < 6) return "pretty bad"; - else if (rating < 9) return "moderate"; - else if (rating < 12) return "passable"; - else if (rating < 15) return "fairly good"; - else if (rating < 18) return "pretty good"; - else if (rating < 20) return "very good"; - else return "brilliant"; - } - -} diff --git a/moobreeder.java b/moobreeder.java deleted file mode 100755 index cbb7a55..0000000 --- a/moobreeder.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Moobreeder is a simple cow breeding game to illustrate the principles of - * selective breeding to KS3 pupils. - * - * (c) Daniel Vedder 2018, - * Amano Christian School - */ - -/* - * This is the main class with the GUI. - */ - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.ArrayList; - -import Cow; - -public class MooBreeder extends JFrame -{ - private JMenuBar menubar; - private JMenu file, help; - private JMenuItem reset, quit, help, about; - private Box herdBox, parentBox, offspringBox; - - public static void main(String[] args) - { - //TODO - } - - public MooBreeder() - { - //TODO - } -} diff --git a/Cow.java b/Cow.java new file mode 100755 index 0000000..7743d25 --- /dev/null +++ b/Cow.java @@ -0,0 +1,90 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This file holds the cow class and associated methods. + */ + +public class Cow +{ + private static int idCounter = 1; + + private int id; + private String name; + private String sex; + private int milk, strength, meat, aggression; + + public Cow(String desiredSex) + { + //Default cow/bull + sex = desiredSex; + id = idCounter; + idCounter++; + name = makeName(sex, id); + milk = 1; + strength = 5; + meat = 1; + aggression = 10; + } + + public Cow(Cow father, Cow mother) + { + //Constructor used for reproduction + //TODO + } + + public String rateCow(Cow c, String use) + { + int rating = 0; + if (use == "dairy") { + rating = rateDairyCow(c); + } + else if (use == "plowing") { + rating = ratePlowCow(c); + } + else if (use == "meat") { + rating = rateMeatCow(c); + } + else { + //error + } + return "This is a "+rating2string(rating)+" cow for "+use+"."; + } + + private int rateDairyCow(Cow c) + { + //TODO + } + + private int rateMeatCow(Cow c) + { + //TODO + } + + private int ratePlowCow(Cow c) + { + //TODO + } + + /* + * Return a string rating for values between 0 and 20. + */ + private String rating2String(int rating) + { + if (rating < 1) return "useless"; + else if (rating < 3) return "terrible"; + else if (rating < 6) return "pretty bad"; + else if (rating < 9) return "moderate"; + else if (rating < 12) return "passable"; + else if (rating < 15) return "fairly good"; + else if (rating < 18) return "pretty good"; + else if (rating < 20) return "very good"; + else return "brilliant"; + } + +} diff --git a/MooBreeder.java b/MooBreeder.java new file mode 100755 index 0000000..cbb7a55 --- /dev/null +++ b/MooBreeder.java @@ -0,0 +1,36 @@ +/** + * Moobreeder is a simple cow breeding game to illustrate the principles of + * selective breeding to KS3 pupils. + * + * (c) Daniel Vedder 2018, + * Amano Christian School + */ + +/* + * This is the main class with the GUI. + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.ArrayList; + +import Cow; + +public class MooBreeder extends JFrame +{ + private JMenuBar menubar; + private JMenu file, help; + private JMenuItem reset, quit, help, about; + private Box herdBox, parentBox, offspringBox; + + public static void main(String[] args) + { + //TODO + } + + public MooBreeder() + { + //TODO + } +} diff --git a/cow.java b/cow.java deleted file mode 100755 index 7743d25..0000000 --- a/cow.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Moobreeder is a simple cow breeding game to illustrate the principles of - * selective breeding to KS3 pupils. - * - * (c) Daniel Vedder 2018, - * Amano Christian School - */ - -/* - * This file holds the cow class and associated methods. - */ - -public class Cow -{ - private static int idCounter = 1; - - private int id; - private String name; - private String sex; - private int milk, strength, meat, aggression; - - public Cow(String desiredSex) - { - //Default cow/bull - sex = desiredSex; - id = idCounter; - idCounter++; - name = makeName(sex, id); - milk = 1; - strength = 5; - meat = 1; - aggression = 10; - } - - public Cow(Cow father, Cow mother) - { - //Constructor used for reproduction - //TODO - } - - public String rateCow(Cow c, String use) - { - int rating = 0; - if (use == "dairy") { - rating = rateDairyCow(c); - } - else if (use == "plowing") { - rating = ratePlowCow(c); - } - else if (use == "meat") { - rating = rateMeatCow(c); - } - else { - //error - } - return "This is a "+rating2string(rating)+" cow for "+use+"."; - } - - private int rateDairyCow(Cow c) - { - //TODO - } - - private int rateMeatCow(Cow c) - { - //TODO - } - - private int ratePlowCow(Cow c) - { - //TODO - } - - /* - * Return a string rating for values between 0 and 20. - */ - private String rating2String(int rating) - { - if (rating < 1) return "useless"; - else if (rating < 3) return "terrible"; - else if (rating < 6) return "pretty bad"; - else if (rating < 9) return "moderate"; - else if (rating < 12) return "passable"; - else if (rating < 15) return "fairly good"; - else if (rating < 18) return "pretty good"; - else if (rating < 20) return "very good"; - else return "brilliant"; - } - -} diff --git a/moobreeder.java b/moobreeder.java deleted file mode 100755 index cbb7a55..0000000 --- a/moobreeder.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Moobreeder is a simple cow breeding game to illustrate the principles of - * selective breeding to KS3 pupils. - * - * (c) Daniel Vedder 2018, - * Amano Christian School - */ - -/* - * This is the main class with the GUI. - */ - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.ArrayList; - -import Cow; - -public class MooBreeder extends JFrame -{ - private JMenuBar menubar; - private JMenu file, help; - private JMenuItem reset, quit, help, about; - private Box herdBox, parentBox, offspringBox; - - public static void main(String[] args) - { - //TODO - } - - public MooBreeder() - { - //TODO - } -} diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..95a12a0 --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Compile, package and run MooBreeder + +javac *.java +jar cfe MooBreeder.jar MooBreeder *.class +rm *.class +java -jar MooBreeder.jar