Skip to content
Snippets Groups Projects
Commit cdb67f64 authored by Goik Martin's avatar Goik Martin
Browse files

Exam marking related improvements

parent 94cffe13
No related branches found
No related tags found
No related merge requests found
......@@ -307,8 +307,9 @@ public static byte getAverage(byte a, final byte b, final byte c) {
<para>Explain both points in the answer box below.</para>
<para>In addition provide a solution by modifying the above code.
You may present your code in the answer box below as well.</para>
<para>In addition provide a solution by modifying the above
implementation without changing the method's signature. You may
present your code in the answer box below as well.</para>
<para>Alternatively correct the implementation of
<package>de.hdm_stuttgart.mi.sd1.task4_no_unit_test</package>.<classname>Mathextend</classname>
......@@ -473,6 +474,12 @@ System.out.println("Result: " +
// Note: final short sum = a + b + c does not even compile as being explained at
// https://freedocs.mi.hdm-stuttgart.de/sd1_sect_arithmeticOperators.html#sd1_explainNoByteByteOperator</programlisting>
<para>Given our sum being within range [-3 * -128, 3 * 127]
dividing by three guarantees <code language="java">avg</code> to
be within [-128, 127]. The <code language="java">(byte)</code>
cast will thus safe with respect to overflow problems of our
returned value.</para>
</answer>
</qandaentry>
</qandadiv>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment