Khalil Saboor 6 vuotta sitten
vanhempi
commit
fb131923c8
6 muutettua tiedostoa jossa 40 lisäystä ja 28 poistoa
  1. 2
    2
      Cat.java
  2. 1
    7
      Dog.java
  3. 2
    3
      Frog.java
  4. 2
    2
      MainApplication.java
  5. 0
    1
      Pet.java
  6. 33
    13
      package.bluej

+ 2
- 2
Cat.java Näytä tiedosto

@@ -8,11 +8,11 @@
8 8
 public class Cat extends Pet
9 9
 {
10 10
     public Cat (String name){    
11
-        super(name);       
11
+        super(name);    
12
+        super.setType("");
12 13
     }
13 14
     
14 15
     public String speak(){    
15 16
         return "mewo";
16 17
     }
17
-    
18 18
 }

+ 1
- 7
Dog.java Näytä tiedosto

@@ -9,16 +9,10 @@ public class Dog extends Pet
9 9
 {
10 10
     public Dog (String name){
11 11
         super(name);
12
-        super.setType("h");
12
+        super.setType("");
13 13
     }
14 14
     public String speak(){
15 15
 
16 16
         return "Bark!";
17 17
     }  
18
-    public String getName(){
19
-    
20
-        return "Max";
21
-    
22
-    }
23
-    
24 18
 }

+ 2
- 3
Frog.java Näytä tiedosto

@@ -7,11 +7,10 @@
7 7
  */
8 8
 public class Frog extends Pet
9 9
 {
10
-   public Frog (String name){
11
-    
10
+   public Frog (String name){    
12 11
         super(name);
12
+        super.setType("");
13 13
     }
14
-    
15 14
    public String speak(){
16 15
     
17 16
         return "ribbit";

+ 2
- 2
MainApplication.java Näytä tiedosto

@@ -4,7 +4,7 @@ import java.util.*;
4 4
 */
5 5
 public class MainApplication {
6 6
 
7
- enum petTypes{CAT, DOG, SNAKE, DEFAULT};
7
+ enum petTypes{CAT, DOG, FROG, DEFAULT};
8 8
  public static void main(String[]args){
9 9
 
10 10
      Scanner scan = new Scanner(System.in);
@@ -30,7 +30,7 @@ public class MainApplication {
30 30
              petArr[i] = new Dog(typeName);
31 31
              break;
32 32
 
33
-             case SNAKE:
33
+             case FROG:
34 34
              petArr[i] = new Frog(typeName);
35 35
              break;
36 36
            

+ 0
- 1
Pet.java Näytä tiedosto

@@ -8,7 +8,6 @@
8 8
 public class Pet 
9 9
 {
10 10
     private String name;
11
-    
12 11
     private String type;
13 12
     public Pet (String name){
14 13
         this.name = name;

+ 33
- 13
package.bluej Näytä tiedosto

@@ -1,4 +1,16 @@
1 1
 #BlueJ package file
2
+dependency1.from=MainApplication
3
+dependency1.to=Pet
4
+dependency1.type=UsesDependency
5
+dependency2.from=MainApplication
6
+dependency2.to=Cat
7
+dependency2.type=UsesDependency
8
+dependency3.from=MainApplication
9
+dependency3.to=Dog
10
+dependency3.type=UsesDependency
11
+dependency4.from=MainApplication
12
+dependency4.to=Frog
13
+dependency4.type=UsesDependency
2 14
 editor.fx.0.height=722
3 15
 editor.fx.0.width=947
4 16
 editor.fx.0.x=333
@@ -13,8 +25,8 @@ package.editor.x=141
13 25
 package.editor.y=59
14 26
 package.frame.height=600
15 27
 package.frame.width=800
16
-package.numDependencies=0
17
-package.numTargets=6
28
+package.numDependencies=4
29
+package.numTargets=7
18 30
 package.showExtends=true
19 31
 package.showUses=true
20 32
 project.charset=UTF-8
@@ -45,23 +57,31 @@ target3.width=80
45 57
 target3.x=300
46 58
 target3.y=300
47 59
 target4.height=50
48
-target4.name=Dog
60
+target4.name=PetTest
49 61
 target4.showInterface=false
50
-target4.type=ClassTarget
62
+target4.type=UnitTestTargetJunit4
51 63
 target4.width=80
52
-target4.x=470
53
-target4.y=230
64
+target4.x=340
65
+target4.y=120
54 66
 target5.height=50
55
-target5.name=Pet
67
+target5.name=Dog
56 68
 target5.showInterface=false
57 69
 target5.type=ClassTarget
58 70
 target5.width=80
59
-target5.x=310
60
-target5.y=150
71
+target5.x=470
72
+target5.y=230
73
+target6.association=PetTest
61 74
 target6.height=50
62
-target6.name=MainApplication
75
+target6.name=Pet
63 76
 target6.showInterface=false
64 77
 target6.type=ClassTarget
65
-target6.width=120
66
-target6.x=70
67
-target6.y=70
78
+target6.width=80
79
+target6.x=310
80
+target6.y=150
81
+target7.height=50
82
+target7.name=MainApplication
83
+target7.showInterface=false
84
+target7.type=ClassTarget
85
+target7.width=120
86
+target7.x=70
87
+target7.y=70