Browse Source

made changes to the answers in quiz

thulasi 6 years ago
parent
commit
40a2b960e2
2 changed files with 26 additions and 22 deletions
  1. 8
    3
      LoopFun.java
  2. 18
    19
      package.bluej

+ 8
- 3
LoopFun.java View File

@@ -47,9 +47,14 @@ public class LoopFun
47 47
       public String encrypt(String word) {
48 48
          
49 49
         String encrypted = "";
50
-        for(int i = 0;i<word.length();i++){
51
-            encrypted += (char)(word.charAt(i) + 3);
50
+         for (int i = 0; i < word.length(); i++) {
51
+            char ch = word.charAt(i);
52
+            if (ch != ' ') {
53
+                ch = (char)((ch - 'a' + 3) % 26 + 'a');
54
+            }
55
+
56
+            encrypted += ch;
52 57
         }
53
-          return null;
58
+          return encrypted;
54 59
       }
55 60
 }

+ 18
- 19
package.bluej View File

@@ -2,25 +2,25 @@
2 2
 dependency1.from=StringUtilitiesTest
3 3
 dependency1.to=StringUtilities
4 4
 dependency1.type=UsesDependency
5
-dependency2.from=BonusTest
6
-dependency2.to=Bonus
5
+dependency2.from=LoopFunTest
6
+dependency2.to=LoopFun
7 7
 dependency2.type=UsesDependency
8 8
 dependency3.from=MathUtilitiesTest
9 9
 dependency3.to=MathUtilities
10 10
 dependency3.type=UsesDependency
11
-editor.fx.0.height=722
12
-editor.fx.0.width=876
13
-editor.fx.0.x=158
14
-editor.fx.0.y=216
15
-objectbench.height=164
11
+editor.fx.0.height=709
12
+editor.fx.0.width=1280
13
+editor.fx.0.x=0
14
+editor.fx.0.y=303
15
+objectbench.height=147
16 16
 objectbench.width=669
17 17
 package.divider.horizontal=0.6
18
-package.divider.vertical=0.7628294036061026
19
-package.editor.height=543
18
+package.divider.vertical=0.7634408602150538
19
+package.editor.height=490
20 20
 package.editor.width=567
21 21
 package.editor.x=557
22
-package.editor.y=43
23
-package.frame.height=779
22
+package.editor.y=303
23
+package.frame.height=709
24 24
 package.frame.width=693
25 25
 package.numDependencies=3
26 26
 package.numTargets=6
@@ -40,20 +40,19 @@ target1.width=110
40 40
 target1.x=110
41 41
 target1.y=150
42 42
 target2.height=50
43
-target2.name=BonusTest
43
+target2.name=LoopFunTest
44 44
 target2.showInterface=false
45 45
 target2.type=UnitTestTargetJunit4
46
-target2.width=80
47
-target2.x=120
48
-target2.y=270
49
-target3.association=BonusTest
46
+target2.width=110
47
+target2.x=10
48
+target2.y=240
50 49
 target3.height=50
51
-target3.name=Bonus
50
+target3.name=LoopFun
52 51
 target3.showInterface=false
53 52
 target3.type=ClassTarget
54 53
 target3.width=80
55
-target3.x=90
56
-target3.y=300
54
+target3.x=200
55
+target3.y=210
57 56
 target4.association=MathUtilitiesTest
58 57
 target4.height=50
59 58
 target4.name=MathUtilities