Upload files to "Aufgaben/PTP_1"
This commit is contained in:
8
Aufgaben/PTP_1/Quadratzahlen.java
Normal file
8
Aufgaben/PTP_1/Quadratzahlen.java
Normal file
@@ -0,0 +1,8 @@
|
||||
public class Quadratzahlen{
|
||||
public static void main(String args[]) {
|
||||
for (int i = 1; i <= 20 ; i++ ) {
|
||||
int quadrat = i * i;
|
||||
System.out.println("Die Quadratzahl von " + i + " lautet " + quadrat);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Aufgaben/PTP_1/Sparbuch.java
Normal file
11
Aufgaben/PTP_1/Sparbuch.java
Normal file
@@ -0,0 +1,11 @@
|
||||
public class Sparbuch{
|
||||
public static void main(String args[]){
|
||||
double guthaben = 1000;
|
||||
double zinssatz = 1.5/100;
|
||||
|
||||
for (int jahr = 1; jahr <= 25 ; jahr++ ) {
|
||||
guthaben = guthaben + guthaben * zinssatz;
|
||||
System.out.println("Guthaben im " + jahr + ". Jahr: " + guthaben);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Aufgaben/PTP_1/Steigung.java
Normal file
21
Aufgaben/PTP_1/Steigung.java
Normal file
@@ -0,0 +1,21 @@
|
||||
public class Steigung {
|
||||
public static void main (String args[]){
|
||||
// Koordinaten x1 und y1 von Punkt P
|
||||
// P(x1 | y1)
|
||||
double x1 = 4;
|
||||
double y1 = 6;
|
||||
|
||||
// Koordinaten x2 und y2 von Punkt Q
|
||||
// Q(x2 | y2)
|
||||
double x2 = 2;
|
||||
double y2 = 1;
|
||||
|
||||
// m = (y2 - y1) / (x2 - x1)
|
||||
double m = (y2 - y1) / (x2 - x1);
|
||||
|
||||
System.out.println("P(" + x1 + " | " + y1 + ")");
|
||||
System.out.println("Q(" + x2 + " | " + y2 + ")");
|
||||
System.out.println("Steigung zwischen P und Q: " + m);
|
||||
|
||||
}
|
||||
}
|
||||
9
Aufgaben/PTP_1/Variablen.java
Normal file
9
Aufgaben/PTP_1/Variablen.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class Variablen{
|
||||
public static void main(String args[]){
|
||||
int zahl = 3;
|
||||
double zahlD = (double) zahl;
|
||||
|
||||
System.out.println("Int: " + zahl + ", Double: " + zahlD);
|
||||
}
|
||||
|
||||
}
|
||||
12
Aufgaben/PTP_1/VariablenTest.java
Normal file
12
Aufgaben/PTP_1/VariablenTest.java
Normal file
@@ -0,0 +1,12 @@
|
||||
public class VariablenTest{
|
||||
public static void main(String args[]){
|
||||
int zaehler = 3;
|
||||
double zaehlerD = (double) zaehler;
|
||||
double bruch = zaehler / 3.14;
|
||||
|
||||
final double pi = 3.1415;
|
||||
|
||||
System.out.println("Zaehler: " + zaehler + ", ZaehlerD: " + zaehlerD);
|
||||
System.out.println("Bruch: " + bruch + ", Pi: " + pi);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user