From c4595f5acb15feca4a127d8047271667e43c82ef Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Wed, 9 Nov 2022 14:56:37 +0100 Subject: [PATCH] Cosmetics --- Doc/Sd1/Statements/statements.xml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Doc/Sd1/Statements/statements.xml b/Doc/Sd1/Statements/statements.xml index 4d2489a1c..3a18d6c52 100644 --- a/Doc/Sd1/Statements/statements.xml +++ b/Doc/Sd1/Statements/statements.xml @@ -970,9 +970,7 @@ You entered 123</screen><para>See <methodname <programlisting language="java">public static void main(String[] args) { - int pointsReached = 7; // May range from 0 to 12 points - - + int pointsReached = 7; // May range from 0 to 12 points final int maximumPoints = 12; final int pointsToAdd = 3; @@ -987,8 +985,10 @@ You entered 123</screen><para>See <methodname <answer> <para>The basic task is to add up the values of <code language="java">pointsReached</code> and <code - language="java">pointsToAdd</code>. When exceeding the limit we - just assign the limit itself:</para> + language="java">pointsToAdd</code>. This sum however must not + exceed the <code language="java">maximumPoints</code> limit. We + use an <code language="java">if</code> statement for constraint + safeguarding:</para> <programlisting language="java">public static void main(String[] args) { @@ -1020,8 +1020,8 @@ final int augmentedMark = maximumPoints <= pointsReached + pointsToAdd ? maxi System.out.println("New marking:" + augmentedMark);</programlisting> - <para>The augmented marks equal the minimum of <code - language="java">(pointsReached + pointsToAdd</code>) and <code + <para>The augmented points value equals the minimum of <code + language="java">pointsReached + pointsToAdd</code> and <code language="java">maximumPoints</code>. In favour of upcoming <link linkend="sd1SectClassMembers">methods</link> we may code as well:</para> @@ -1041,8 +1041,9 @@ System.out.println("New marking:" + augmentedMark);</programlisting> <para>You will fully understand the above expression <classname xlink:href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Math.html">Math</classname>.<methodname xlink:href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Math.html#min(int,int)">min(...)</methodname> - after finishing the <quote>Static Final Variables</quote> - section of <xref linkend="bib_Kurniawan"/>.</para> + expression after finishing the <quote>Static Final + Variables</quote> section of <xref + linkend="bib_Kurniawan"/>.</para> </answer> </qandaentry> </qandadiv> -- GitLab