-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarrollTest.java
More file actions
executable file
·46 lines (43 loc) · 1.38 KB
/
Copy pathCarrollTest.java
File metadata and controls
executable file
·46 lines (43 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* In addition to writing the Alice in Wonderland books, Lewis Carroll
* wrote on the subject of math and logic.
* Write a new class named Carroll, with a method isItDespised() as
* described in the test below.
*
* @author ace
* @version 11 April 2010
*/
public class CarrollTest
{
Carroll carroll;
/**
* Constructor for objects of class CarrollTest
*/
public CarrollTest(){
carroll = new Carroll();
}
/**
* All babies are illogical.
* Nobody is despised who can manage a crocodile.
* Illogical persons are despised.
*
* This doesn't explain whether logical persons
* who cannot manage a crococdile are despised or not,
* so we assume that they are not.
*
* Do not change the Person class, only your new class Carroll.
*/
public void testIsItDespised(){
Person baby = new Person(true, false, true);
Person crocHunter = new Person(false, true, false);
Person ambiguous = new Person(false, false, true);
boolean babyD = carroll.isItDespised(baby);
boolean crocD = carroll.isItDespised(crocHunter);
boolean ambiD = carroll.isItDespised(ambiguous);
if(babyD==true && crocD==false && ambiD==false){
System.out.println("testIsItDespised passed!");
} else {
System.out.println("testIsItDespised failed");
}
}
}