Kaynağa Gözat

repulled info from repo

Trinh Tong 6 yıl önce
ebeveyn
işleme
c4030f2464
5 değiştirilmiş dosya ile 55 ekleme ve 3 silme
  1. BIN
      .DS_Store
  2. 3
    1
      Console.java
  3. 5
    2
      RealAdvanced.java
  4. 8
    0
      RealAdvancedTest.java
  5. 39
    0
      package.bluej

BIN
.DS_Store Dosyayı Görüntüle


+ 3
- 1
Console.java Dosyayı Görüntüle

@@ -116,8 +116,10 @@ public class Console {
116 116
                     advAnswer = advCalc.opposite(advInput1);
117 117
                 }else if (mode.equals("5")){
118 118
                     advAnswer = advCalc.absoluteValue(advInput1);
119
+                }else if (mode.equals("6")){
120
+                    advAnswer = advCalc.sqrt(advInput1);
119 121
 
120
-                }else if (mode.equals("6")) {
122
+                }else if (mode.equals("7")) {
121 123
                     break;
122 124
                 }else{
123 125
                     Console.println("Invalid input");

+ 5
- 2
RealAdvanced.java Dosyayı Görüntüle

@@ -19,7 +19,8 @@ public class RealAdvanced
19 19
             "3: 1/x" + "\n"+
20 20
             "4: Switch Sign of x" + "\n"+
21 21
             "5: Absolute Value of x" + "\n"+
22
-            "6: Return to Main Menu");
22
+            "6: Square Root of x" + "\n"+
23
+            "7: Return to Main Menu");
23 24
 
24 25
     }
25 26
     // method to find x^2
@@ -42,5 +43,7 @@ public class RealAdvanced
42 43
     public double absoluteValue(double x){
43 44
         return Math.abs(x);
44 45
     }
45
-
46
+public double sqrt(double x){
47
+    return Math.sqrt(x);
48
+}
46 49
 }

+ 8
- 0
RealAdvancedTest.java Dosyayı Görüntüle

@@ -74,9 +74,17 @@ public class RealAdvancedTest
74 74
         RealAdvanced realAdva1 = new RealAdvanced();
75 75
         assertEquals(4.0, realAdva1.absoluteValue(-4), 0.1);
76 76
     }
77
+
78
+    @Test
79
+    public void squareRootTest()
80
+    {
81
+        RealAdvanced realAdva1 = new RealAdvanced();
82
+        assertEquals(5.0, realAdva1.sqrt(25), 0.1);
83
+    }
77 84
 }
78 85
 
79 86
 
80 87
 
81 88
 
82 89
 
90
+

+ 39
- 0
package.bluej Dosyayı Görüntüle

@@ -3,6 +3,7 @@ dependency1.from=MainMenu
3 3
 dependency1.to=Console
4 4
 dependency1.type=UsesDependency
5 5
 dependency10.from=Console
6
+<<<<<<< HEAD
6 7
 dependency10.to=RealAdvanced
7 8
 dependency10.type=UsesDependency
8 9
 dependency11.from=Console
@@ -24,6 +25,33 @@ dependency2.from=SciCalc
24 25
 dependency2.to=Console
25 26
 dependency2.type=UsesDependency
26 27
 dependency3.from=MainApplication
28
+=======
29
+dependency10.to=Basic
30
+dependency10.type=UsesDependency
31
+dependency11.from=Console
32
+dependency11.to=RealAdvanced
33
+dependency11.type=UsesDependency
34
+dependency12.from=Console
35
+dependency12.to=SciCalc
36
+dependency12.type=UsesDependency
37
+dependency13.from=Console
38
+dependency13.to=MemoryFunc
39
+dependency13.type=UsesDependency
40
+dependency14.from=Console
41
+dependency14.to=SwitchDisplay
42
+dependency14.type=UsesDependency
43
+dependency15.from=Console
44
+dependency15.to=Trig
45
+dependency15.type=UsesDependency
46
+dependency16.from=RealAdvancedTest
47
+dependency16.to=RealAdvanced
48
+dependency16.type=UsesDependency
49
+dependency2.from=SciCalc
50
+dependency2.to=Console
51
+dependency2.type=UsesDependency
52
+dependency3.from=MemoryFunc
53
+>>>>>>> 49d5555735b5e26b8076429d9dd1666b4918738c
54
+>>>>>>> 3fa2b863a93d1b5548a82c34b3920f059a52833d
27 55
 dependency3.to=Console
28 56
 dependency3.type=UsesDependency
29 57
 dependency4.from=Trig
@@ -32,17 +60,28 @@ dependency4.type=UsesDependency
32 60
 dependency5.from=Basic
33 61
 dependency5.to=Console
34 62
 dependency5.type=UsesDependency
63
+<<<<<<< HEAD
35 64
 dependency6.from=RealAdvanced
36 65
 dependency6.to=Console
37 66
 dependency6.type=UsesDependency
38 67
 dependency7.from=MemoryFunc
68
+=======
69
+dependency6.from=SwitchDisplay
70
+dependency6.to=Console
71
+dependency6.type=UsesDependency
72
+dependency7.from=MainMenu
73
+>>>>>>> 3fa2b863a93d1b5548a82c34b3920f059a52833d
39 74
 dependency7.to=Console
40 75
 dependency7.type=UsesDependency
41 76
 dependency8.from=Console
42 77
 dependency8.to=MainMenu
43 78
 dependency8.type=UsesDependency
44 79
 dependency9.from=Console
80
+<<<<<<< HEAD
45 81
 dependency9.to=Basic
82
+=======
83
+dependency9.to=MainMenu
84
+>>>>>>> 3fa2b863a93d1b5548a82c34b3920f059a52833d
46 85
 dependency9.type=UsesDependency
47 86
 editor.fx.0.height=749
48 87
 editor.fx.0.width=1215