Преглед изворни кода

Merge branch 'master' of mdimarino/ZCW-MacroLabs-OOP-ScientificCalculator into master

trtong пре 6 година
родитељ
комит
a9b3412439
3 измењених фајлова са 98 додато и 106 уклоњено
  1. BIN
      .DS_Store
  2. 71
    0
      RealAdvanced.java
  3. 27
    106
      package.bluej

+ 71
- 0
RealAdvanced.java Прегледај датотеку

@@ -0,0 +1,71 @@
1
+
2
+/**
3
+ * Method for the RealAdvanced class
4
+ *
5
+ * @Michelle DiMarino
6
+ * @10.21.18
7
+ */
8
+
9
+import java.util.*;
10
+
11
+public class RealAdvanced
12
+{
13
+
14
+    public void RealAdvanced()
15
+    {
16
+        String prompt1 = "Please Select one of the following Calculations: " +"\n"+
17
+            "Option 1: x^2" + "\n"+
18
+            "Option 2: x^y" + "\n"+
19
+            "Option 3: 1/x" + "\n"+
20
+            "Option 4: Switch Sign of x" + "\n"+
21
+            "Option 5: Return to Main Menu";
22
+
23
+        Integer option = Console.getIntegerInput(prompt1);
24
+        String prompt = "Enter value of x";
25
+        double x = Console.getDoubleInput(prompt1);
26
+        while (option != 5){
27
+            if (option == 1){
28
+                squared(x);
29
+
30
+            }else if (option == 2){
31
+                String prompt2= "Enter Value of y";
32
+                double y = Console.getDoubleInput(prompt2);
33
+                exponent(x,y);
34
+
35
+            }else if (option == 3){
36
+                String prompt3= "Enter Value of x";
37
+                int input = Console.getIntegerInput(prompt3);
38
+                inverse(input);
39
+
40
+            }else if (option == 4){
41
+                opposite(x);
42
+
43
+            }else {
44
+                Console.println("Invalid input");
45
+            }
46
+        } 
47
+    }
48
+    // method to find x^2
49
+    public void squared(double x){
50
+
51
+        Console.println(Double.toString(Math.pow(x,2)));
52
+    }
53
+    // method to find x^y
54
+    public void exponent(double x, double y){
55
+
56
+        Console.println(Double.toString(Math.pow(x,y)));
57
+    }
58
+    // method to find the inverse of x
59
+    public void inverse(int x){
60
+
61
+        Console.println(Integer.toString(Integer.reverse(x)));
62
+    }
63
+    // method to switch sign of x
64
+    public void opposite(double x){
65
+
66
+        double opposite1 = -1 * x;
67
+        Console.println(Double.toString(opposite1));
68
+
69
+    }
70
+
71
+}

+ 27
- 106
package.bluej Прегледај датотеку

@@ -1,62 +1,26 @@
1 1
 #BlueJ package file
2
-dependency1.from=Trig
2
+dependency1.from=MainApplication
3 3
 dependency1.to=Console
4 4
 dependency1.type=UsesDependency
5
-dependency10.from=MainApplication
6
-dependency10.to=MemoryFunc
7
-dependency10.type=UsesDependency
8
-dependency11.from=MainApplication
9
-dependency11.to=SwitchDisplay
10
-dependency11.type=UsesDependency
11
-dependency12.from=MainApplication
12
-dependency12.to=Console
13
-dependency12.type=UsesDependency
14
-dependency2.from=Basic
5
+dependency2.from=RealAdvanced
15 6
 dependency2.to=Console
16 7
 dependency2.type=UsesDependency
17
-dependency3.from=BasicTest
18
-dependency3.to=Basic
19
-dependency3.type=UsesDependency
20
-dependency4.from=SciCalc
21
-dependency4.to=Console
22
-dependency4.type=UsesDependency
23
-dependency5.from=MemoryFunc
24
-dependency5.to=Console
25
-dependency5.type=UsesDependency
26
-dependency6.from=SwitchDisplay
27
-dependency6.to=Console
28
-dependency6.type=UsesDependency
29
-dependency7.from=MainMenu
30
-dependency7.to=Console
31
-dependency7.type=UsesDependency
32
-dependency8.from=MainApplication
33
-dependency8.to=MainMenu
34
-dependency8.type=UsesDependency
35
-dependency9.from=MainApplication
36
-dependency9.to=SciCalc
37
-dependency9.type=UsesDependency
38
-editor.fx.0.height=0
39
-editor.fx.0.width=0
40
-editor.fx.0.x=0
41
-editor.fx.0.y=0
42
-editor.fx.0.height=722
43
-editor.fx.0.width=1120
44
-editor.fx.0.x=320
45
-editor.fx.0.y=119
46
-=======
47
->>>>>>> origin
48
-objectbench.height=214
49
-objectbench.width=706
8
+editor.fx.0.height=709
9
+editor.fx.0.width=800
10
+editor.fx.0.x=338
11
+editor.fx.0.y=23
12
+objectbench.height=198
13
+objectbench.width=595
50 14
 package.divider.horizontal=0.6
51
-package.divider.vertical=0.720253164556962
52
-package.editor.height=562
53
-package.editor.width=604
15
+package.divider.vertical=0.685099846390169
16
+package.editor.height=439
17
+package.editor.width=493
54 18
 package.editor.x=35
55
-package.editor.y=60
56
-package.frame.height=848
57
-package.frame.width=730
58
-package.numDependencies=12
59
-package.numTargets=9
19
+package.editor.y=23
20
+package.frame.height=709
21
+package.frame.width=619
22
+package.numDependencies=2
23
+package.numTargets=3
60 24
 package.showExtends=true
61 25
 package.showUses=true
62 26
 project.charset=UTF-8
@@ -65,67 +29,24 @@ readme.name=@README
65 29
 readme.width=47
66 30
 readme.x=10
67 31
 readme.y=10
68
-target1.association=BasicTest
69 32
 target1.height=50
70
-target1.name=Basic
33
+target1.name=RealAdvanced
71 34
 target1.showInterface=false
72 35
 target1.type=ClassTarget
73
-target1.width=80
74
-target1.x=320
75
-target1.y=180
36
+target1.width=110
37
+target1.x=300
38
+target1.y=40
76 39
 target2.height=50
77
-target2.name=SciCalc
40
+target2.name=Console
78 41
 target2.showInterface=false
79 42
 target2.type=ClassTarget
80 43
 target2.width=80
81
-target2.x=120
82
-target2.y=10
44
+target2.x=80
45
+target2.y=200
83 46
 target3.height=50
84
-target3.name=MemoryFunc
47
+target3.name=MainApplication
85 48
 target3.showInterface=false
86 49
 target3.type=ClassTarget
87
-target3.width=110
88
-target3.x=10
89
-target3.y=130
90
-target4.height=50
91
-target4.name=Console
92
-target4.showInterface=false
93
-target4.type=ClassTarget
94
-target4.width=80
95
-target4.x=80
96
-target4.y=200
97
-target5.height=50
98
-target5.name=BasicTest
99
-target5.showInterface=false
100
-target5.type=UnitTestTargetJunit4
101
-target5.width=80
102
-target5.x=350
103
-target5.y=150
104
-target6.height=50
105
-target6.name=Trig
106
-target6.showInterface=false
107
-target6.type=ClassTarget
108
-target6.width=80
109
-target6.x=320
110
-target6.y=70
111
-target7.height=50
112
-target7.name=SwitchDisplay
113
-target7.showInterface=false
114
-target7.type=ClassTarget
115
-target7.width=110
116
-target7.x=120
117
-target7.y=130
118
-target8.height=50
119
-target8.name=MainMenu
120
-target8.showInterface=false
121
-target8.type=ClassTarget
122
-target8.width=90
123
-target8.x=170
124
-target8.y=190
125
-target9.height=50
126
-target9.name=MainApplication
127
-target9.showInterface=false
128
-target9.type=ClassTarget
129
-target9.width=120
130
-target9.x=70
131
-target9.y=70
50
+target3.width=120
51
+target3.x=70
52
+target3.y=70