forked from jean/GDP-Uebungen
files added
This commit is contained in:
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="false" project-jdk-name="15" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Uebung03.iml" filepath="$PROJECT_DIR$/Uebung03.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
public class CountDown {
|
||||
public static void main(String[] args){
|
||||
System.out.println();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Kreis {
|
||||
public static void main(String[] args){
|
||||
double radius, umfang, flaeche;
|
||||
System.out.print("Radius eingeben: ");
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
radius = Double.parseDouble(scanner.nextLine());
|
||||
umfang = radius*2*Math.PI;
|
||||
flaeche = Math.pow(radius,2)*Math.PI;
|
||||
System.out.println("Umfang" + umfang);
|
||||
System.out.println("Flaeche: " + flaeche);
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
public class Liveuebung {
|
||||
public static void crazyLoop(String[] args){
|
||||
int zaehler= 0;
|
||||
while(zaehler < 3){
|
||||
System.out.println(zaehler++);
|
||||
|
||||
}
|
||||
}
|
||||
public static int calc(int[] numbers){
|
||||
int sum = 0;
|
||||
for(int i=numbers.length-1;i>=0;i--){
|
||||
sum += numbers[i];
|
||||
}
|
||||
return sum*sum;
|
||||
}
|
||||
|
||||
public static int calc2(int... numbers){
|
||||
int sum=0;
|
||||
for(int number:numbers){
|
||||
sum += number;
|
||||
}
|
||||
return sum*sum;
|
||||
}
|
||||
public static void main(String[] args){
|
||||
int[] input = {1,2,3};
|
||||
int ret = calc(input);
|
||||
System.out.println("Ergebnis: " + ret);
|
||||
System.out.println("Anzahl " + input.length);
|
||||
System.out.println("-----------------");
|
||||
System.out.println("Rechne" + calc2(1,2,3));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import java.util.Scanner;
|
||||
public class SatellitenZeit {
|
||||
public static void main(String[] args) {
|
||||
long d, h, m, s;
|
||||
long dR, hR, mR;
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
long sekundenIn = Long.parseLong(scanner.nextLine());
|
||||
d = sekundenIn / (60*60*24);
|
||||
dR = sekundenIn % (60*60*24);
|
||||
h = dR / (60*60);
|
||||
hR = dR % (60*60);
|
||||
m = hR / 60;
|
||||
mR = hR % 60;
|
||||
s = mR;
|
||||
|
||||
System.out.println("Tage: " + d + " Stunden: " + h + " Minuten: " + m + " Sekunden: " + s);
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.util.Scanner;
|
||||
public class ScannerBeispiel {
|
||||
public static void main(String[] args){
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
byte byteWert = Byte.parseByte(scanner.nextLine());
|
||||
short shortWert = Short.parseShort(scanner.nextLine());
|
||||
int intWert = Integer.parseInt(scanner.nextLine());
|
||||
long longWert = Long.parseLong(scanner.nextLine());
|
||||
float floatWert = Float.parseFloat(scanner.nextLine());
|
||||
double doubleWert = Double.parseDouble(scanner.nextLine());
|
||||
boolean booleanWert = Boolean.parseBoolean(scanner.nextLine());
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import java.util.Scanner;
|
||||
public class Steuer {
|
||||
public static void main(String[] args){
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
double bruttoBetrag, steuerSatz, nettoBetrag, mWst;
|
||||
|
||||
System.out.print("Brutto Betrag eingeben: ");
|
||||
bruttoBetrag = Double.parseDouble(scanner.nextLine());
|
||||
System.out.print("Mehrwertsteuersatz eingeben: ");
|
||||
steuerSatz = Double.parseDouble(scanner.nextLine());
|
||||
|
||||
nettoBetrag = bruttoBetrag / (1.0+steuerSatz);
|
||||
mWst = bruttoBetrag -nettoBetrag;
|
||||
|
||||
System.out.println("Netto-Betrag: " + nettoBetrag);
|
||||
|
||||
System.out.println("Mehrwertsteuer: " + mWst);
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.util.Scanner;
|
||||
public class Temperatur {
|
||||
public static void main(String[] args){
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
double tempIn = Double.parseDouble(scanner.nextLine());
|
||||
double tempOut = 9.0/5.0 * tempIn + 32.0;
|
||||
System.out.println(tempIn + " Grad Celsius entsprechen " + tempOut + " Grad Fahrenheit");
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user