From 629015091eb33734c537b2cd32b40e7740a3e9d9 Mon Sep 17 00:00:00 2001
From: Martin Goik <goik@hdm-stuttgart.de>
Date: Mon, 15 May 2017 10:13:05 +0200
Subject: [PATCH] More details in loop exercise

---
 Doc/Sd1/gettingStarted.xml | 68 +++++++++++++++++++++++++++++++-------
 1 file changed, 56 insertions(+), 12 deletions(-)

diff --git a/Doc/Sd1/gettingStarted.xml b/Doc/Sd1/gettingStarted.xml
index 2b92bd5bb..c1be265b9 100644
--- a/Doc/Sd1/gettingStarted.xml
+++ b/Doc/Sd1/gettingStarted.xml
@@ -634,22 +634,66 @@ System.out.println(...);</programlisting>
       }
    }</programlisting>
 
-              <para>Examine the result.Then modify this code to create 5 more
-              lines of output.</para>
+              <para>Examine the result and implement the following
+              modifications:</para>
+
+              <orderedlist>
+                <listitem>
+                  <para>Create five additional lines of output</para>
+                </listitem>
+
+                <listitem>
+                  <para>Enlarge the gap between two adjacent lines of output
+                  to a value of 3 retaining the same number of output
+                  lines:</para>
+
+                  <programlisting language="none">loop # 0
+loop # 3
+loop # 6
+loop # 9
+loop # 12</programlisting>
+                </listitem>
+              </orderedlist>
             </question>
 
             <answer>
-              <para>We only have to modify the while condition from <code>i
-              &lt; 5</code> to <code>i &lt; 10</code>.</para>
+              <orderedlist>
+                <listitem>
+                  <para>The number of output lines is being determined by the
+                  loop's termination condition <code>i &lt; 5</code>.
+                  Replacing this limit by <code>while ( i &lt; 10)</code>
+                  achieves the desired result:</para>
+                </listitem>
 
-              <programlisting language="java">   public static void main(String[] args) {
-      
-      int i = 0;
-      while ( i &lt; 10) {
-         System.out.println("loop # " + i);
-         i = i + 1;
-      }
-   }</programlisting>
+                <listitem>
+                  <para>We may adjust two related parameters:</para>
+
+                  <programlisting language="java">while ( i &lt; 15 <co
+                      linkends="qandaPlayLoop-1" xml:id="qandaPlayLoop-1-co"/>) {
+   System.out.println("loop # " + i);
+   i = i + 3 <co linkends="qandaPlayLoop-2" xml:id="qandaPlayLoop-2-co"/>;
+}</programlisting>
+
+                  <calloutlist>
+                    <callout arearefs="qandaPlayLoop-1-co"
+                             xml:id="qandaPlayLoop-1">
+                      <para>Adjusting the limit to accommodate larger
+                      values.</para>
+                    </callout>
+
+                    <callout arearefs="qandaPlayLoop-2-co"
+                             xml:id="qandaPlayLoop-2">
+                      <para>Raising the gap to a value of 3.</para>
+                    </callout>
+                  </calloutlist>
+
+                  <para>Alternatively we may as well modify the print
+                  statement:</para>
+
+                  <programlisting language="java">System.out.println("loop # " + <emphasis
+                      role="bold">i * 3</emphasis>);</programlisting>
+                </listitem>
+              </orderedlist>
             </answer>
           </qandaentry>
         </qandadiv>
-- 
GitLab