2024-05-13 14:04:23 +00:00
|
|
|
package VL04.Aufgabe04;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Vorlesung 4 / Aufgabe 4
|
|
|
|
*
|
|
|
|
* @author Sebastian Brosch
|
|
|
|
*/
|
|
|
|
public class Aufgabe04 {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
final int laufzeit = 4;
|
|
|
|
final double startwert = 100.0;
|
2024-05-16 08:50:07 +00:00
|
|
|
final double[] zinssaetze = new double[] { 2.0, 2.5, 3.0 };
|
2024-05-13 14:04:23 +00:00
|
|
|
double entwicklung[][] = new double[laufzeit][zinssaetze.length];
|
|
|
|
|
|
|
|
for (int i = 0; i < laufzeit; i++) {
|
|
|
|
for (int z = 0; z < zinssaetze.length; z++) {
|
|
|
|
double wert = (i == 0) ? startwert : entwicklung[i - 1][z];
|
|
|
|
entwicklung[i][z] = wert + (wert * (zinssaetze[z] / 100.0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.printf("Laufzeit: %d Jahre - Startwert: %.2f EUR\n\n", laufzeit, startwert);
|
|
|
|
System.out.printf("Jahr");
|
|
|
|
|
|
|
|
for (int z = 0; z < zinssaetze.length; z++) {
|
|
|
|
System.out.printf("\t%11.2f%%", zinssaetze[z]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < entwicklung.length; i++) {
|
|
|
|
System.out.printf("\n%d", (2023 + 1) + i);
|
|
|
|
|
|
|
|
for (int z = 0; z < zinssaetze.length; z++) {
|
|
|
|
System.out.printf("\t%8.2f EUR", entwicklung[i][z]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|