-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZinsrechner.java
30 lines (21 loc) · 925 Bytes
/
Zinsrechner.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package easydatatype;
import java.util.Scanner;
public class Zinsrechner {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Eingabe der Laufzeit, des Grundbetrags und des Zinssatzes
System.out.print("Laufzeit in Jahren: ");
int laufzeit = input.nextInt();
System.out.print("Grundbetrag: ");
double grundbetrag = input.nextDouble();
System.out.print("Zinssatz (in Prozent): ");
double zinssatz = input.nextDouble();
// Zinsen berechnen
double zinsen = (grundbetrag * zinssatz / 100) * laufzeit;
double gesamtwert = grundbetrag + zinsen;
// Ausgabe der berechneten Zinsen und des Gesamtwerts
System.out.println("Zinsen: " + zinsen);
System.out.println("Gesamtwert: " + gesamtwert);
input.close();
}
}