Lewis Dominguez 8 년 전
부모
커밋
3ddbcac2fe
9개의 변경된 파일219개의 추가작업 그리고 1개의 파일을 삭제
  1. BIN
      .DS_Store
  2. BIN
      FizzBuzz.class
  3. 14
    0
      FizzBuzz.ctxt
  4. 48
    0
      FizzBuzz.java
  5. BIN
      FizzBuzzTest.class
  6. 21
    0
      FizzBuzzTest.ctxt
  7. 95
    0
      FizzBuzzTest.java
  8. 0
    0
      README.TXT
  9. 41
    1
      package.bluej

BIN
.DS_Store 파일 보기


BIN
FizzBuzz.class 파일 보기


+ 14
- 0
FizzBuzz.ctxt 파일 보기

@@ -0,0 +1,14 @@
1
+#BlueJ class context
2
+comment0.target=FizzBuzz
3
+comment0.text=\n\ Write\ a\ description\ of\ class\ FizzBuzz\ here.\n\n\ @author\ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=
5
+comment1.target=FizzBuzz()
6
+comment2.params=num
7
+comment2.target=java.lang.String\ fizzBuzz1(int)
8
+comment3.params=num
9
+comment3.target=java.lang.String\ fizz(int)
10
+comment4.params=num
11
+comment4.target=java.lang.String\ buzz(int)
12
+comment5.params=num
13
+comment5.target=java.lang.String\ fizzBuzz(int)
14
+numComments=6

+ 48
- 0
FizzBuzz.java 파일 보기

@@ -0,0 +1,48 @@
1
+
2
+/**
3
+ * Write a description of class FizzBuzz here.
4
+ *
5
+ * @author (your name)
6
+ * @version (a version number or a date)
7
+ */
8
+public class FizzBuzz
9
+{
10
+    public FizzBuzz() {
11
+    }  
12
+    String fb = "";
13
+    
14
+    public String fizzBuzz1(int num) {
15
+        if(3 % num == 0) {
16
+            fb = "Fizz";
17
+        } else if (5 % num == 0) {
18
+            fb = "Buzz";
19
+        } else if (15 % num == 0) {
20
+            fb = "FizzBuzz";
21
+        } else{
22
+            fb = String.valueOf(num);
23
+        }
24
+        return fb;
25
+    }
26
+    
27
+    public String fizz(int num) {
28
+        if(3 % num == 0) {
29
+            fb = "Fizz";
30
+        }
31
+        return fb;
32
+    }
33
+    
34
+    public String buzz(int num) {
35
+        if(5 % num == 0) {
36
+            fb = "Buzz";
37
+        }
38
+        return fb;
39
+    }
40
+    
41
+    public String fizzBuzz(int num) {
42
+        if(15 % num == 0) {
43
+            fb = "FizzBuzz";
44
+        }
45
+        return fb;
46
+    }
47
+    
48
+}

BIN
FizzBuzzTest.class 파일 보기


+ 21
- 0
FizzBuzzTest.ctxt 파일 보기

@@ -0,0 +1,21 @@
1
+#BlueJ class context
2
+comment0.target=FizzBuzzTest
3
+comment0.text=\n\ The\ test\ class\ FizzBuzzTest.\n\n\ @author\ \ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=
5
+comment1.target=FizzBuzzTest()
6
+comment1.text=\n\ Default\ constructor\ for\ test\ class\ FizzBuzzTest\n
7
+comment2.params=
8
+comment2.target=void\ setUp()
9
+comment2.text=\n\ Sets\ up\ the\ test\ fixture.\n\n\ Called\ before\ every\ test\ case\ method.\n
10
+comment3.params=
11
+comment3.target=void\ testIfNumberIsNotDivisibleBy3()
12
+comment4.params=
13
+comment4.target=void\ testForFizz()
14
+comment5.params=
15
+comment5.target=void\ testForBuzz()
16
+comment6.params=
17
+comment6.target=void\ testForFizzBuzz()
18
+comment7.params=
19
+comment7.target=void\ tearDown()
20
+comment7.text=\n\ Tears\ down\ the\ test\ fixture.\n\n\ Called\ after\ every\ test\ case\ method.\n
21
+numComments=8

+ 95
- 0
FizzBuzzTest.java 파일 보기

@@ -0,0 +1,95 @@
1
+
2
+
3
+import static org.junit.Assert.*;
4
+import org.junit.After;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+/**
9
+ * The test class FizzBuzzTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class FizzBuzzTest
15
+{
16
+    /**
17
+     * Default constructor for test class FizzBuzzTest
18
+     */
19
+    public FizzBuzzTest()
20
+    {
21
+    }
22
+
23
+    /**
24
+     * Sets up the test fixture.
25
+     *
26
+     * Called before every test case method.
27
+     */
28
+    @Before
29
+    public void setUp()
30
+    {
31
+    }
32
+    
33
+    @Test
34
+    public void testIfNumberIsNotDivisibleBy3() {
35
+    //When
36
+    FizzBuzz fizz = new FizzBuzz();
37
+    //Expected
38
+    String equals = "8";
39
+    //Actual
40
+    String actual = fizz.fizzBuzz1(8);
41
+    
42
+    assertEquals(equals, actual);
43
+    
44
+    }
45
+    
46
+    @Test
47
+    public void testForFizz() {
48
+    //When
49
+    FizzBuzz fizz = new FizzBuzz();
50
+    //Expected
51
+    String equals = "Fizz";
52
+    //Actual
53
+    String actual = fizz.fizz(3);
54
+    
55
+    assertEquals(equals, actual);
56
+    
57
+    
58
+    }
59
+    
60
+    @Test
61
+    public void testForBuzz() {
62
+    //When
63
+    FizzBuzz fizz = new FizzBuzz();
64
+    //Expected
65
+    String equals = "Buzz";
66
+    //Actual
67
+    String actual = fizz.buzz(5);
68
+    
69
+    assertEquals(equals, actual);
70
+    }
71
+    
72
+    @Test
73
+    public void testForFizzBuzz() {
74
+    //When
75
+    FizzBuzz fizz = new FizzBuzz();
76
+    //Expected
77
+    String equals = "FizzBuzz";
78
+    //Actual
79
+    String actual = fizz.fizzBuzz(15);
80
+    
81
+    assertEquals(equals, actual);
82
+    }
83
+    
84
+    
85
+
86
+    /**
87
+     * Tears down the test fixture.
88
+     *
89
+     * Called after every test case method.
90
+     */
91
+    @After
92
+    public void tearDown()
93
+    {
94
+    }
95
+}

+ 0
- 0
README.TXT 파일 보기


+ 41
- 1
package.bluej 파일 보기

@@ -1,3 +1,43 @@
1 1
 #BlueJ package file
2
-#Thu May 31 13:04:16 EDT 2018
2
+dependency1.from=FizzBuzzTest
3
+dependency1.to=FizzBuzz
4
+dependency1.type=UsesDependency
5
+editor.fx.0.height=722
6
+editor.fx.0.width=677
7
+editor.fx.0.x=314
8
+editor.fx.0.y=23
9
+objectbench.height=101
10
+objectbench.width=634
11
+package.divider.horizontal=0.6
12
+package.divider.vertical=0.8368580060422961
13
+package.editor.height=547
14
+package.editor.width=532
15
+package.editor.x=6
16
+package.editor.y=23
17
+package.frame.height=720
18
+package.frame.width=658
19
+package.numDependencies=1
20
+package.numTargets=2
21
+package.showExtends=true
22
+package.showUses=true
3 23
 project.charset=UTF-8
24
+readme.height=58
25
+readme.name=@README
26
+readme.width=47
27
+readme.x=10
28
+readme.y=10
29
+target1.association=FizzBuzzTest
30
+target1.height=50
31
+target1.name=FizzBuzz
32
+target1.showInterface=false
33
+target1.type=ClassTarget
34
+target1.width=80
35
+target1.x=60
36
+target1.y=150
37
+target2.height=50
38
+target2.name=FizzBuzzTest
39
+target2.showInterface=false
40
+target2.type=UnitTestTargetJunit4
41
+target2.width=110
42
+target2.x=90
43
+target2.y=120