File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
main/java/com/thealgorithms/conversions
test/java/com/thealgorithms/conversions Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,9 @@ private static BigDecimal convertWordQueueToBigDecimal(ArrayDeque<String> wordDe
171
171
List <BigDecimal > chunks = new ArrayList <>();
172
172
173
173
boolean isNegative = "negative" .equals (wordDeque .peek ());
174
- if (isNegative ) wordDeque .poll ();
174
+ if (isNegative ) {
175
+ wordDeque .poll ();
176
+ }
175
177
176
178
boolean prevNumWasHundred = false ;
177
179
boolean prevNumWasPowerOfTen = false ;
@@ -189,6 +191,9 @@ private static BigDecimal convertWordQueueToBigDecimal(ArrayDeque<String> wordDe
189
191
prevNumWasHundred = true ;
190
192
continue ;
191
193
}
194
+ default -> {
195
+
196
+ }
192
197
}
193
198
prevNumWasHundred = false ;
194
199
@@ -213,7 +218,12 @@ private static BigDecimal convertWordQueueToBigDecimal(ArrayDeque<String> wordDe
213
218
currentChunk = BigDecimal .ZERO ;
214
219
continue ;
215
220
}
216
- case "negative" -> handleNegative (isNegative );
221
+ case "negative" -> {
222
+ handleNegative (isNegative );
223
+ }
224
+ default -> {
225
+
226
+ }
217
227
}
218
228
219
229
throw new WordsToNumberException (WordsToNumberException .ErrorType .UNKNOWN_WORD , word );
@@ -224,7 +234,8 @@ private static BigDecimal convertWordQueueToBigDecimal(ArrayDeque<String> wordDe
224
234
}
225
235
226
236
BigDecimal completeNumber = combineChunks (chunks );
227
- return isNegative ? completeNumber .multiply (BigDecimal .valueOf (-1 )) :
237
+ return isNegative ? completeNumber .multiply (BigDecimal .valueOf (-1 ))
238
+ :
228
239
completeNumber ;
229
240
}
230
241
Original file line number Diff line number Diff line change 1
1
package com .thealgorithms .conversions ;
2
2
3
3
import static org .junit .jupiter .api .Assertions .assertEquals ;
4
- import static org .junit .jupiter .api .Assertions .assertNull ;
5
4
import static org .junit .jupiter .api .Assertions .assertThrows ;
6
5
7
6
import java .math .BigDecimal ;
You can’t perform that action at this time.
0 commit comments