Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

macguyver1

By: ace on May 12th, 2010  |  syntax: None  |  size: 1.54 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**
  2.  * Write a new class called Superfluous which allows the test below
  3.  * to pass.
  4.  *
  5.  * @author ace
  6.  * @version 11 April 2010
  7.  */
  8. public class SuperfluousTest
  9. {
  10.  
  11.     /**
  12.      * Constructor for objects of class SuperfluousTest
  13.      */
  14.     public SuperfluousTest(){
  15.     }
  16.  
  17.     /**
  18.      * All March hares are mad.
  19.      * Nothing which is mad is superfluous.
  20.      * All politicians are superfluous.
  21.      * All managers are politicians.
  22.      * All secretaries are mad.
  23.      * All rabbits that are white are wonderous.
  24.      * All wonderous things that are late are rabbits.
  25.      * No wonderous things which are not late are rabbits.
  26.      * Things which are late are superfluous.
  27.      * Are managers superfluous? Are secretaries? Is a white rabbit superfluous?
  28.      */
  29.     public void testIsItSuperfluous(){
  30.         Superfluous superflu = new Superfluous();
  31.         Person manager = new Person();
  32.         manager.setIsAManager();
  33.         Person secretary = new Person();
  34.         secretary.setIsASecretary();
  35.         Person whiteRabbit = new Person();
  36.         whiteRabbit.setIsARabbit();
  37.         whiteRabbit.setIsWhite();
  38.         boolean managerB = superflu.isItSuperfluous(manager);
  39.         boolean secretaryB = superflu.isItSuperfluous(secretary);
  40.         boolean whiteB = superflu.isItSuperfluous(whiteRabbit);
  41.         if(managerB==true && secretaryB == false && whiteB==true){
  42.             System.out.println("testIsItSuperfluous passed!");
  43.         } else {
  44.             System.out.println("testIsItSuperfluous failed");
  45.         }
  46.     }
  47. }