Nuridalia.Hernandez преди 5 години
родител
ревизия
98c59f1b86

+ 2
- 1
src/main/java/rocks/zipcode/quiz5/fundamentals/Calculator.java Целия файл

@@ -10,7 +10,8 @@ public class Calculator {
10 10
     }
11 11
 
12 12
     public static Double square(Double value) {
13
-        return Math.pow(value ,value);
13
+
14
+        return value * value;
14 15
     }
15 16
 
16 17
     public static Double[] squareRoots(Double... value) {

+ 13
- 2
src/main/java/rocks/zipcode/quiz5/fundamentals/StringUtils.java Целия файл

@@ -32,16 +32,27 @@ public class StringUtils {
32 32
     }
33 33
 
34 34
     public static Boolean hasDuplicateConsecutiveCharacters(String str) {
35
-        for (int i = 0; i <str.length() ; i++) {
35
+        String [] arr = str.split("");
36
+        for (int i = 0; i <arr.length-1; i++) {
37
+            for (int j = i+ 1; j <arr.length; j++) {
38
+                if (arr[i] == arr[j]){
39
+                    return true;
40
+                }
41
+
42
+            }
36 43
 
37 44
         }
38 45
 
39 46
 
40 47
 
41
-        return null;
48
+        return false;
42 49
     }
43 50
 
44 51
     public static String removeConsecutiveDuplicateCharacters(String str) {
52
+
53
+
54
+
55
+
45 56
         return null;
46 57
     }
47 58
 

+ 8
- 3
src/main/java/rocks/zipcode/quiz5/objectorientation/account/BankAccount.java Целия файл

@@ -12,13 +12,18 @@ public class BankAccount  extends Account implements Transactable {
12 12
 
13 13
 
14 14
     @Override
15
-    public void deposit(Double amountToIncreaseBy) {
15
+    public void deposit(Double amountToIncreaseBy) throws  IllegalArgumentException{
16
+        if(amountToIncreaseBy>0)
16 17
        valance = valance + amountToIncreaseBy;
17 18
     }
18 19
 
19 20
     @Override
20
-    public void withdrawal(Double amountToDecreaseBy) {
21
-    valance= valance - (amountToDecreaseBy);
21
+    public void withdrawal(Double amountToDecreaseBy)throws IllegalArgumentException  {
22
+        // if(valance > amountToDecreaseBy)
23
+       valance = valance - amountToDecreaseBy;
24
+
25
+
26
+
22 27
     }
23 28
 
24 29
     @Override