Commit abc2f46
Changed files (3)
src/Q1/README.md
@@ -20,6 +20,132 @@ Note that an empty space is also a character, and that the index starts from pos
Now print the contents of the character array on the console.
2. Description of the Code:
+
+
3. Errors and Warnings:
+
+* - Program compiles OK using maven and vim
+* - Unit tests pass using maven.
+
+```bash
+[INFO] Scanning for projects...
+[INFO]
+[INFO] -------------------< ca.mokhan.comp268:assignment2 >--------------------
+[INFO] Building assignment2 1.0-SNAPSHOT
+[INFO] --------------------------------[ jar ]---------------------------------
+[INFO]
+[INFO] --- fmt-maven-plugin:2.8:format (default) @ assignment2 ---
+[INFO] Processed 7 files (0 reformatted).
+[INFO]
+[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ assignment2 ---
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/mokha/development/comp-268/src/main/resources
+[INFO]
+[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ assignment2 ---
+[INFO] Changes detected - recompiling the module!
+[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
+[INFO] Compiling 4 source files to /home/mokha/development/comp-268/target/classes
+[INFO]
+[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ assignment2 ---
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/mokha/development/comp-268/src/test/resources
+[INFO]
+[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ assignment2 ---
+[INFO] Changes detected - recompiling the module!
+[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
+[INFO] Compiling 4 source files to /home/mokha/development/comp-268/target/test-classes
+[INFO]
+[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ assignment2 ---
+[INFO] Surefire report directory: /home/mokha/development/comp-268/target/surefire-reports
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running ca.mokhan.test.ReversedSentenceTest
+Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 sec
+Running ca.mokhan.comp268.AppTest
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
+
+Results :
+
+Tests run: 7, Failures: 0, Errors: 0, Skipped: 0
+
+[INFO]
+[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ assignment2 ---
+[INFO] Building jar: /home/mokha/development/comp-268/target/assignment2-1.0-SNAPSHOT.jar
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESS
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 2.183 s
+[INFO] Finished at: 2019-06-02T21:46:13-06:00
+[INFO] ------------------------------------------------------------------------
+```
+
4. Sample Input and Output:
+
+* - Manually running the program with valid input.
+
+```bash
+モ bundle exec rake run1
+javac ReversedSentence.java
+java ReversedSentence
+Enter sentence 1:
+mary had a little lamb
+Enter sentence 2:
+mary had a little lamb
+Enter sentence 3:
+mary had a little lamb
+
+Result:
+
+bmal elttil a dah yram
+lamb little a had mary
+mary zad azlittze lazb
+
+Bye
+```
+
+* - Manually running the program with input greater than 80 characters.
+
+```bash
+モ bundle exec rake run1
+javac ReversedSentence.java
+java ReversedSentence
+Enter sentence 1:
+123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+Enter sentence 2:
+123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+Enter sentence 3:
+123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+
+Result:
+
+09876543210987654321098765432109876543210987654321098765432109876543210987654321
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+12345z7890z2345z7890z2345z7890z2345z7890z2345z7890z2345z7890z2345z7890z2345z7890
+
+Bye
+```
+
+* - Manually running the program with no input
+
+```bash
+モ bundle exec rake run1
+javac ReversedSentence.java
+java ReversedSentence
+Enter sentence 1:
+
+Enter sentence 2:
+
+Enter sentence 3:
+
+
+Result:
+
+
+
+
+
+Bye
+```
5. Discussion:
src/Q1/ReversedSentence.java
@@ -6,15 +6,14 @@
* @date Jun 2, 2019
* @version 1.0
*/
-
package Q1;
import java.util.Scanner;
public class ReversedSentence {
/**
- * Replaces the every character that is in an index that is evenly
- * divisible by 5 with the character 'z', excluding 0.
+ * Replaces the every character that is in an index that is evenly divisible by 5 with the
+ * character 'z', excluding 0.
*
* @param s The input string to substitue
* @return The new string with the substitution.
Rakefile
@@ -28,9 +28,7 @@ task :run do
end
task :run1 do
- puts 'hi'
Dir.chdir 'src/Q1' do
- puts Dir.pwd
sh 'javac ReversedSentence.java'
sh 'java ReversedSentence'
end