diff options
| author | mo <mo.khan@gmail.com> | 2019-06-02 21:56:43 -0600 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2019-06-02 21:56:43 -0600 |
| commit | b754fe0ae62308ecfd9464b824e90bdb1a147380 (patch) | |
| tree | 26f3adb549425a146e9957657d4f3edb47c47728 /src/Q1 | |
| parent | abc2f460b19e9f99ada48c32a54a328f580494b2 (diff) | |
update prompt to limit to 80 characters
Diffstat (limited to 'src/Q1')
| -rw-r--r-- | src/Q1/README.md | 27 | ||||
| -rw-r--r-- | src/Q1/ReversedSentence.java | 2 |
2 files changed, 19 insertions, 10 deletions
diff --git a/src/Q1/README.md b/src/Q1/README.md index 7bf1ead..14c7bdd 100644 --- a/src/Q1/README.md +++ b/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: diff --git a/src/Q1/ReversedSentence.java b/src/Q1/ReversedSentence.java index e0d55c0..5cd46e6 100644 --- a/src/Q1/ReversedSentence.java +++ b/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()); } |
