diff --git a/Sd1/P/rounding/src/main/java/de/hdm_stuttgart/de/sd1/rounding/MathTable.java b/Sd1/P/rounding/src/main/java/de/hdm_stuttgart/de/sd1/rounding/MathTable.java index fddc219a481ff841fdb251b3a60ed95993619fe3..c2b35fc8bdf559fa425399e366421d5e8a8548f2 100644 --- a/Sd1/P/rounding/src/main/java/de/hdm_stuttgart/de/sd1/rounding/MathTable.java +++ b/Sd1/P/rounding/src/main/java/de/hdm_stuttgart/de/sd1/rounding/MathTable.java @@ -27,20 +27,21 @@ public class MathTable { if (fraction < 0) { fraction *= -1; - System.out.print(i + " |-" + digit + "." + fraction); + System.out.print(i + " |-" + digit + "."); } else if (-1 < digit){ - System.out.print(i + " | " + digit + "." + fraction); + System.out.print(i + " | " + digit + "."); } else { - System.out.print(i + " |" + digit + "." + fraction); + System.out.print(i + " |" + digit + "."); } - if (fraction < 9) { // Padding with zeros - System.out.println("00"); // One digit, add two zeros + if (fraction < 9) { // Padding fraction with zeros + System.out.print("00"); // One digit, add two zeros } else if (fraction < 99) { - System.out.println("0"); // Two digits, add two zeros - } else { - System.out.println(); // Three digits, just add a newline - } + System.out.print("0"); // Two digits, add two zeros + } + + System.out.println(fraction); + if (0 < i && 0 == i % 20) { System.out.println("----+------"); } diff --git a/Sd1/swd1.xml b/Sd1/swd1.xml index 3445e04fe4a6d6962ac7eef35f13a371683225bf..5e386d1f81126bfa4ea7f778a22001e19fc4d711 100644 --- a/Sd1/swd1.xml +++ b/Sd1/swd1.xml @@ -2912,9 +2912,9 @@ Is 2016 a leap year? true</programlisting> sine function rounded to three decimal places:</para> <programlisting language="ignore"> x | sin(x) -----+------- +----+------ 0 | 0.000 - 5 | 0.870 + 5 | 0.087 10 | 0.174 15 | 0.259 20 | 0.342