Commit b754fe0
Changed files (2)
src
src/Q1/README.md
@@ -21,6 +21,14 @@ Now print the contents of the character array on the console.
2. Description of the Code:
+The API for this code uses several static methods. Each static methods takes an input string or
+character matrix as an input argument.
+
+The code depends on constructing new instances of strings to perform substitutions or reversing operations.
+
+If more than 80 characters is provided as input the string is truncated to the first 80 characters provided.
+The remaining characters are abondoned. It is assumed that the person entering the sentence will enter sentences that are 80 characters or less.
+
3. Errors and Warnings:
@@ -89,11 +97,11 @@ Tests run: 7, Failures: 0, Errors: 0, Skipped: 0
モ bundle exec rake run1
javac ReversedSentence.java
java ReversedSentence
-Enter sentence 1:
+Enter sentence 1: (max 80 characters)
mary had a little lamb
-Enter sentence 2:
+Enter sentence 2: (max 80 characters)
mary had a little lamb
-Enter sentence 3:
+Enter sentence 3: (max 80 characters)
mary had a little lamb
Result:
@@ -111,11 +119,11 @@ Bye
モ bundle exec rake run1
javac ReversedSentence.java
java ReversedSentence
-Enter sentence 1:
+Enter sentence 1: (max 80 characters)
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-Enter sentence 2:
+Enter sentence 2: (max 80 characters)
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-Enter sentence 3:
+Enter sentence 3: (max 80 characters)
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
Result:
@@ -133,11 +141,11 @@ Bye
モ bundle exec rake run1
javac ReversedSentence.java
java ReversedSentence
-Enter sentence 1:
+Enter sentence 1: (max 80 characters)
-Enter sentence 2:
+Enter sentence 2: (max 80 characters)
-Enter sentence 3:
+Enter sentence 3: (max 80 characters)
Result:
@@ -148,4 +156,5 @@ Result:
Bye
```
+
5. Discussion:
src/Q1/ReversedSentence.java
@@ -91,7 +91,7 @@ public class ReversedSentence {
String[] sentences = new String[3];
for (int i = 0; i < 3; i++) {
- System.out.println(String.format("Enter sentence %d: ", i + 1));
+ System.out.println(String.format("Enter sentence %d: (max 80 characters)", i + 1));
sentences[i] = ReversedSentence.truncateSentence(in.nextLine());
}