Przeglądaj źródła

wrote psedo code for varius functions, create new function to extract numbers from a string - get numbers

Jonathan Hinds 6 lat temu
rodzic
commit
6345fc8752
1 zmienionych plików z 16 dodań i 24 usunięć
  1. 16
    24
      Calculations.java

+ 16
- 24
Calculations.java Wyświetl plik

@@ -78,11 +78,23 @@ public class Calculations
78 78
         //return result;
79 79
     }
80 80
     
81
+    public static ArrayList<Double> getNumbers(String userInput){
82
+        ArrayList<Double> results = new ArrayList<Double>();
83
+        //takes in a string
84
+        //finds the first occurence of a number
85
+        //store it as a double ( left )
86
+        //add this to the arraylist
87
+        //find the second occurence of a number
88
+        //store it as a double (right)
89
+        //add this to the array list
90
+        //if the size of the arraylist is 2
91
+            //return the array list
92
+        //else return null
93
+        return results;
94
+    }
95
+    
81 96
     public static String Multiply(String userInput)
82 97
     {
83
-        //take in a string
84
-        //take the numbers out of the string
85
-        //convert them to doubles
86 98
         //perform the operation
87 99
         //convert to string
88 100
         //return string
@@ -91,9 +103,6 @@ public class Calculations
91 103
 
92 104
     public static String Divide(String userInput)
93 105
     {
94
-        //take in a string
95
-        //take the numbers out of the string
96
-        //convert them to doubles
97 106
         //perform the operation
98 107
         //convert to string
99 108
         //return string
@@ -102,9 +111,6 @@ public class Calculations
102 111
 
103 112
         public static String Add(String userInput)
104 113
     {
105
-        //take in a string
106
-        //take the numbers out of the string
107
-        //convert them to doubles
108 114
         //perform the operation
109 115
         //convert to string
110 116
         //return string
@@ -113,9 +119,6 @@ public class Calculations
113 119
     
114 120
     public static String Subtract(String userInput)
115 121
     {
116
-        //take in a string
117
-        //take the numbers out of the string
118
-        //convert them to doubles
119 122
         //perform the operation
120 123
         //convert to string
121 124
         //return string
@@ -124,9 +127,6 @@ public class Calculations
124 127
  
125 128
     public static String InvertSign(String userInput)
126 129
     {
127
-        //take in a string
128
-        //take the numbers out of the string
129
-        //convert them to doubles
130 130
         //perform the operation
131 131
         //convert to string
132 132
         //return string
@@ -135,9 +135,6 @@ public class Calculations
135 135
     
136 136
     public static String InvertNumber(String userInput)
137 137
     {
138
-        //take in a string
139
-        //take the numbers out of the string
140
-        //convert them to doubles
141 138
         //perform the operation
142 139
         //convert to string
143 140
         //return string
@@ -146,11 +143,6 @@ public class Calculations
146 143
 
147 144
     public static void Clear()
148 145
     {
149
-        //take in a string
150
-        //take the numbers out of the string
151
-        //convert them to doubles
152
-        //perform the operation
153
-        //convert to string
154
-        //return string
146
+        //reset the default value to 0
155 147
     }
156 148
 }