Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. class MarriedCouple extends Couple {
  2.     private Person a;
  3.     private Person b;
  4.  
  5.     public MarriedCouple(Person a, Person b) {
  6.         this.a = a;
  7.         this.b = b;
  8.  
  9.         // Removed in 2014 because of #ek-123-242
  10.         //if (a.gender == b.gender) {
  11.         //  throw new GayException("u fucking gay");
  12.         //}
  13.     }
  14.  
  15.     public boolean bothParentsAreGood() {
  16.         return (!sameSex() && (this.a.isAGoodParent() && this.b.isAGoodParent()));
  17.     }
  18.  
  19.     private boolean sameSex() {
  20.         return (this.a.gender == this.b.gender);
  21.     }
  22. }
  23.  
  24. class Person {
  25.     private int gender;
  26.  
  27.     public Person(int gender) {
  28.         this.gender = gender;
  29.     }
  30.  
  31.     public boolean isAGoodParent() {
  32.         // @todo: implement
  33.     }
  34. }
  35.  
  36. class Adoption {
  37.     ArrayList<Person> parents;
  38.     Person child;
  39.  
  40.     public Adoption(Person personWhoWantsAChild, Person theChild) throws EvilSonOfABitchException {
  41.         if (personWhoWantsAChild.isAGoodParent()) {
  42.             this.parents = new ArrayList<Person>();
  43.             this.parents.add(personWhoWantsAChild);
  44.  
  45.             this.child = theChild;
  46.         } else {
  47.             throw new EvilSonOfABitchException("You're not a good parent, gtfo!");
  48.         }
  49.     }
  50.  
  51.     public Adoption(Couple couple, Person theChild) throws GayException {
  52.         if (couple.bothParentsAreGood()) {
  53.             this.parents.add(couple.getA());
  54.             this.parents.add(couple.getB());
  55.  
  56.             this.child = theChild;
  57.         } else {
  58.             throw new GayException("You're gays, gtfo.")
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement