forked from jean/GDP-Uebungen
		
	files added
This commit is contained in:
		
							parent
							
								
									47b69ca811
								
							
						
					
					
						commit
						3edae31699
					
				
							
								
								
									
										8
									
								
								Uebung_1/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Uebung_1/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | { | ||||||
|  |     "files.exclude": { | ||||||
|  |         "**/.classpath": true, | ||||||
|  |         "**/.project": true, | ||||||
|  |         "**/.settings": true, | ||||||
|  |         "**/.factorypath": true | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_1/A1/SumTemplate/SumTemplate.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_1/A1/SumTemplate/SumTemplate.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										26
									
								
								Uebung_1/A1/SumTemplate/SumTemplate.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								Uebung_1/A1/SumTemplate/SumTemplate.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | public class SumTemplate { | ||||||
|  |     public static void main(String[] args){ | ||||||
|  |         // Ganze Zahl, bis zu der summiert wird | ||||||
|  |         int boundary; | ||||||
|  |         // Summe der bisher addierten ganzen Zahlen | ||||||
|  |         int sum; | ||||||
|  |         // Ganze Zahl | ||||||
|  |         int counter; | ||||||
|  | 
 | ||||||
|  |         // Festlegen der Startwerte | ||||||
|  |         boundary = 4; | ||||||
|  |         sum = 0; | ||||||
|  |         counter = 1; | ||||||
|  | 
 | ||||||
|  |         // Berechnen der Summe sum über alle Zahlen von 1 bis boundary | ||||||
|  |         while(counter <= boundary){ | ||||||
|  |             sum = sum + counter; | ||||||
|  |             counter = counter + 1; | ||||||
|  |         } | ||||||
|  |         // Ausgaben der Summe, gemeinsam mit erläuterndem Text | ||||||
|  |         System.out.print("Die Summe der Zahlen von 1 bis "); | ||||||
|  |         System.out.print(boundary); | ||||||
|  |         System.out.print(" ist "); | ||||||
|  |         System.out.print(sum); | ||||||
|  |     }  | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_1/GdP-Uebung01-v1_8.10.2020.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_1/GdP-Uebung01-v1_8.10.2020.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_1/HelloWorld/HelloWorld.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_1/HelloWorld/HelloWorld.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										5
									
								
								Uebung_1/HelloWorld/HelloWorld.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Uebung_1/HelloWorld/HelloWorld.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | public class HelloWorld { | ||||||
|  |     public static void main (String[] args) { | ||||||
|  |     System.out.println("Hello World!"); | ||||||
|  |     } | ||||||
|  |    }  | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_1/Sum/Sum.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_1/Sum/Sum.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										35
									
								
								Uebung_1/Sum/Sum.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Uebung_1/Sum/Sum.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | |||||||
|  | public class Sum { | ||||||
|  |     public static void main(String[] args){ | ||||||
|  |         // Ganze Zahl, bis zu der summiert wird | ||||||
|  |         int boundary; | ||||||
|  |         // Summe der bisher addierten ganzen Zahlen | ||||||
|  |         int sum; | ||||||
|  |         // Ganze Zahl | ||||||
|  |         int counter; | ||||||
|  | 
 | ||||||
|  |         // Festlegen der Startwerte | ||||||
|  |         boundary = 10; | ||||||
|  |         sum = 0; | ||||||
|  |         counter = 1; | ||||||
|  | 
 | ||||||
|  |          | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         for(int i = 0 ; i <= boundary;i++){ | ||||||
|  |             System.out.print("-------- boundary set to "); | ||||||
|  |             System.out.print(i); | ||||||
|  |             System.out.print(" -------\n"); | ||||||
|  |             // Berechnen der Summe sum über alle Zahlen von 1 bis boundary | ||||||
|  |             while(counter <= i){ | ||||||
|  |                 sum = sum + counter; | ||||||
|  |                 counter = counter + 1; | ||||||
|  |             } | ||||||
|  |             System.out.print("Die Summe der Zahlen von 1 bis "); | ||||||
|  |             System.out.print(i); | ||||||
|  |             System.out.print(" ist "); | ||||||
|  |             System.out.print(sum); | ||||||
|  |             System.out.print("\n---------- fin ---------\n\n"); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     }  | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe1/Variablen.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe1/Variablen.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										21
									
								
								Uebung_2/Aufgabe1/Variablen.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Uebung_2/Aufgabe1/Variablen.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | |||||||
|  | public class Variablen{ | ||||||
|  |     public static void main(String[]args){ | ||||||
|  |         byte bVar1 = 5; | ||||||
|  |         short sVar1 = 400; | ||||||
|  |         int iVar1 = -35676; | ||||||
|  |         long lVar1 = 100000000L; | ||||||
|  |         float fVar1 = 0.123f; | ||||||
|  |         double dVar1 = 0.123; | ||||||
|  |         boolean istPrim1 = false; | ||||||
|  |         char cVar1 = 'x'; | ||||||
|  |         System.out.println(); | ||||||
|  |         System.out.println(bVar1); | ||||||
|  |         System.out.println(sVar1); | ||||||
|  |         System.out.println(iVar1); | ||||||
|  |         System.out.println(lVar1); | ||||||
|  |         System.out.println(fVar1); | ||||||
|  |         System.out.println(dVar1); | ||||||
|  |         System.out.println(cVar1); | ||||||
|  |         System.out.println(istPrim1); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe2/Variablen.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe2/Variablen.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										21
									
								
								Uebung_2/Aufgabe2/Variablen.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Uebung_2/Aufgabe2/Variablen.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | |||||||
|  | public class Variablen{ | ||||||
|  |     public static void main(String[]args){ | ||||||
|  |         byte bVar1 = 5; | ||||||
|  |         short sVar1 = 400; | ||||||
|  |         int iVar1 = -35676; | ||||||
|  |         long lVar1 = 100000000L; | ||||||
|  |         float fVar1 = 0.123f; | ||||||
|  |         double dVar1 = 0.123; | ||||||
|  |         boolean istPrim1 = false; | ||||||
|  |         char cVar1 = 'x'; | ||||||
|  |         System.out.println(); | ||||||
|  |         System.out.println(bVar1); | ||||||
|  |         System.out.println(sVar1); | ||||||
|  |         System.out.println(iVar1); | ||||||
|  |         System.out.println(lVar1); | ||||||
|  |         System.out.println(fVar1); | ||||||
|  |         System.out.println(dVar1); | ||||||
|  |         System.out.println(cVar1); | ||||||
|  |         System.out.println(istPrim1); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe3/Verdienstrechner.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe3/Verdienstrechner.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								Uebung_2/Aufgabe3/Verdienstrechner.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Uebung_2/Aufgabe3/Verdienstrechner.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | public class Verdienstrechner{ | ||||||
|  |     public static void main(String[] args){ | ||||||
|  |         float stunden = 7; | ||||||
|  |         float stundenlohn = 12.0f; | ||||||
|  |         float verdienst = stunden*stundenlohn; | ||||||
|  | 
 | ||||||
|  |         System.out.print("Stundenlohn: "); | ||||||
|  |         System.out.println(stundenlohn); | ||||||
|  | 
 | ||||||
|  |         System.out.println("Stundenlohn: " + stundenlohn); | ||||||
|  | 
 | ||||||
|  |         System.out.println("Stunden insgesamt: " + stunden); | ||||||
|  |          | ||||||
|  |         System.out.println("Ich habe " + verdienst + " verdient."); | ||||||
|  |          | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe4/Verdienstrechner.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_2/Aufgabe4/Verdienstrechner.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										35
									
								
								Uebung_2/Aufgabe4/Verdienstrechner.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Uebung_2/Aufgabe4/Verdienstrechner.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | |||||||
|  | import java.util.Scanner; | ||||||
|  | 
 | ||||||
|  | public class Verdienstrechner { | ||||||
|  |     public static void main(String[] args) { | ||||||
|  |         float stunden = 9f; | ||||||
|  |         float stundenlohn = 12.0f; | ||||||
|  |         float ueStundenlohn = 17.5f; | ||||||
|  |         float ueStunden = 0; | ||||||
|  |         float regArbeitszeit = 8; | ||||||
|  |         Scanner scan = new Scanner(System.in); | ||||||
|  |         System.out.print("Standardwerte verwenden? [J/n]: "); | ||||||
|  |         if (scan.nextLine().equalsIgnoreCase("n")) { | ||||||
|  |             System.out.print("\nDeine regulaere Arbeitszeit: "); | ||||||
|  |             regArbeitszeit = scan.nextFloat(); | ||||||
|  |             System.out.print("\nWie viel verdienst du in der Stunde?: "); | ||||||
|  |             stundenlohn = scan.nextFloat(); | ||||||
|  |             System.out.print("\n Wie viel Stunden hast du gearbeitet?: "); | ||||||
|  |             stunden = scan.nextFloat(); | ||||||
|  |             System.out.print("\n Wie viel verdienst du bei Überstunden?:"); | ||||||
|  |             ueStundenlohn = scan.nextFloat(); | ||||||
|  |         } | ||||||
|  |         System.out.println("------ BERECHNE-------\n"); | ||||||
|  |         System.out.println("Stundenlohn: " + stundenlohn); | ||||||
|  |         System.out.println("Stunden insgesamt: " + stunden); | ||||||
|  |         if (stunden > regArbeitszeit) { | ||||||
|  |             ueStunden = stunden - regArbeitszeit; | ||||||
|  |             System.out.println("Ueberstunden: " + ueStunden); | ||||||
|  |             stunden = 8; | ||||||
|  |         } | ||||||
|  |         float verdienst = stunden * stundenlohn + ueStundenlohn * ueStunden; | ||||||
|  | 
 | ||||||
|  |         System.out.println("Ich habe " + verdienst + " verdient."); | ||||||
|  |         scan.close(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_2/GdP-Uebung02-v1.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_2/GdP-Uebung02-v1.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										3
									
								
								Uebung_3/.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Uebung_3/.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | # Default ignored files | ||||||
|  | /shelf/ | ||||||
|  | /workspace.xml | ||||||
							
								
								
									
										6
									
								
								Uebung_3/.idea/misc.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Uebung_3/.idea/misc.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @ -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> | ||||||
							
								
								
									
										8
									
								
								Uebung_3/.idea/modules.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Uebung_3/.idea/modules.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @ -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> | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/GdP-Uebung03-v1.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/GdP-Uebung03-v1.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										11
									
								
								Uebung_3/Uebung03.iml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Uebung_3/Uebung03.iml
									
									
									
									
									
										Normal file
									
								
							| @ -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> | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/CountDown.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/CountDown.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Kreis.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Kreis.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Liveuebung.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Liveuebung.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/SatellitenZeit.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/SatellitenZeit.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/ScannerBeispiel.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/ScannerBeispiel.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Steuer.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Steuer.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Temperatur.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_3/out/production/Uebung03/Temperatur.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										6
									
								
								Uebung_3/src/CountDown.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Uebung_3/src/CountDown.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | public class CountDown { | ||||||
|  |     public static void main(String[] args){ | ||||||
|  |         System.out.println(); | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										15
									
								
								Uebung_3/src/Kreis.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Uebung_3/src/Kreis.java
									
									
									
									
									
										Normal file
									
								
							| @ -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(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										35
									
								
								Uebung_3/src/Liveuebung.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Uebung_3/src/Liveuebung.java
									
									
									
									
									
										Normal file
									
								
							| @ -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)); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										19
									
								
								Uebung_3/src/SatellitenZeit.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Uebung_3/src/SatellitenZeit.java
									
									
									
									
									
										Normal file
									
								
							| @ -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(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										14
									
								
								Uebung_3/src/ScannerBeispiel.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Uebung_3/src/ScannerBeispiel.java
									
									
									
									
									
										Normal file
									
								
							| @ -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(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										20
									
								
								Uebung_3/src/Steuer.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Uebung_3/src/Steuer.java
									
									
									
									
									
										Normal file
									
								
							| @ -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(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										10
									
								
								Uebung_3/src/Temperatur.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Uebung_3/src/Temperatur.java
									
									
									
									
									
										Normal file
									
								
							| @ -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(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										3
									
								
								Uebung_4/.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Uebung_4/.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | # Default ignored files | ||||||
|  | /shelf/ | ||||||
|  | /workspace.xml | ||||||
							
								
								
									
										6
									
								
								Uebung_4/.idea/misc.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Uebung_4/.idea/misc.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @ -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> | ||||||
							
								
								
									
										8
									
								
								Uebung_4/.idea/modules.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Uebung_4/.idea/modules.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="ProjectModuleManager"> | ||||||
|  |     <modules> | ||||||
|  |       <module fileurl="file://$PROJECT_DIR$/U4.iml" filepath="$PROJECT_DIR$/U4.iml" /> | ||||||
|  |     </modules> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_4/GdP-Uebung04-v1.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_4/GdP-Uebung04-v1.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										11
									
								
								Uebung_4/U4.iml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Uebung_4/U4.iml
									
									
									
									
									
										Normal file
									
								
							| @ -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> | ||||||
							
								
								
									
										
											BIN
										
									
								
								Uebung_4/out/production/U4/Maximum.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_4/out/production/U4/Maximum.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_4/out/production/U4/Schnittmenge.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_4/out/production/U4/Schnittmenge.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Uebung_4/out/production/U4/Wechselgeld.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Uebung_4/out/production/U4/Wechselgeld.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										27
									
								
								Uebung_4/src/Maximum.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Uebung_4/src/Maximum.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | |||||||
|  | import java.util.Scanner; | ||||||
|  | public class Maximum { | ||||||
|  |     public static void main(String[] args){ | ||||||
|  |         System.out.print("Bitte geben Sie die Anzahl der Zufallszahlen an: "); | ||||||
|  |         Scanner scanner = new Scanner(System.in); | ||||||
|  |         int arraySize = Integer.parseInt(scanner.next()); | ||||||
|  |         double[] valueStore = new double[arraySize]; | ||||||
|  |         for (int i=0; i<arraySize;i++){ | ||||||
|  |             valueStore[i] = Math.random(); | ||||||
|  |             System.out.println("#" + i + " : " + valueStore[i]); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         System.out.println("Die größte Zahl hat den index: " + max(valueStore)); | ||||||
|  |     } | ||||||
|  |     public static int max(double input[]){ | ||||||
|  |         int index=0; | ||||||
|  |         double largestNumber = 0; | ||||||
|  |         for(int i=0; i<input.length;i++){ | ||||||
|  |             if(largestNumber<input[i]){ | ||||||
|  |                 largestNumber = input[i]; | ||||||
|  |                 index = i; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return index; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										33
									
								
								Uebung_4/src/Schnittmenge.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Uebung_4/src/Schnittmenge.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | |||||||
|  | //import java.util.Scanner; | ||||||
|  | import java.util.Arrays; | ||||||
|  | public class Schnittmenge { | ||||||
|  |     public static void main(String[] args){ | ||||||
|  |         //Scanner scanner = new Scanner(System.in); | ||||||
|  |         int[] set1a = {0, 1, 2, 3, 4, 5}; | ||||||
|  |         int[] set1b = {3, 4, 5, 6, 7, 8}; | ||||||
|  |         int[] set2a = {0, 1, 2, 3}; | ||||||
|  |         int[] set2b = {4, 5, 6}; | ||||||
|  |         int[] set3a = {0, 1, 2}; | ||||||
|  |         int[] set3b = {0, 1, 2}; | ||||||
|  |         System.out.println(Arrays.toString(schnittmenge(set1a, set1b))); | ||||||
|  |         System.out.println(Arrays.toString(schnittmenge(set2a, set2b))); | ||||||
|  |         System.out.println(Arrays.toString(schnittmenge(set3a, set3b))); | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static int[] schnittmenge(int[] arrA,int[] arrB){ | ||||||
|  |         int resArrSize = 0; | ||||||
|  |         for(int numberA:arrA){ | ||||||
|  |             for(int numberB:arrB){ | ||||||
|  |                 if(numberA==numberB) resArrSize++; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         int[] resultArr = new int[resArrSize]; | ||||||
|  |         for(int numberA:arrA){ | ||||||
|  |             for(int numberB:arrB){ | ||||||
|  |                 if(numberA==numberB) resultArr[--resArrSize] = numberA; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return resultArr; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										36
									
								
								Uebung_4/src/Wechselgeld.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Uebung_4/src/Wechselgeld.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | |||||||
|  | import java.util.Scanner; | ||||||
|  | public class Wechselgeld { | ||||||
|  |     public static void main(String... args){ | ||||||
|  |         Scanner scanner = new Scanner(System.in); | ||||||
|  |         System.out.print("Bitte Preis engeben: "); | ||||||
|  |         float preis = Float.parseFloat(scanner.nextLine()); | ||||||
|  |         System.out.print("Bitte Betrag engeben: "); | ||||||
|  |         float zahlung = Float.parseFloat(scanner.nextLine()); | ||||||
|  |         if(wechselgeld(preis,zahlung)) System.out.println("Vielen Dank!"); | ||||||
|  |         else System.out.println("Das reicht leider nicht."); | ||||||
|  |     } | ||||||
|  |     public static boolean wechselgeld(float sollWert, float istWert){ | ||||||
|  |         float[] scheine = {100f, 50f, 20f, 10f, 50f}; | ||||||
|  |         float[] muenzen = {2f, 1f, 0.50f, 0.20f, 0.10f, 0.05f, 0.02f, 0.01f}; | ||||||
|  |         int[] anzScheine = new int[scheine.length]; | ||||||
|  |         int[] anzMuenzen = new int[muenzen.length]; | ||||||
|  |         if(istWert<sollWert) return false; | ||||||
|  |         else{ | ||||||
|  |             float ruekGeld = istWert - sollWert; | ||||||
|  |             System.out.println("_______________ Scheine _____________"); | ||||||
|  |             for(int i=0; i<scheine.length; i++){ | ||||||
|  |                 anzScheine[i] = (int) (ruekGeld / scheine[i]); | ||||||
|  |                 ruekGeld -= scheine[i]*(float)anzScheine[i]; | ||||||
|  |                 if(anzScheine[i]>0) System.out.println(anzScheine[i] + " x " + scheine[i] + " EUR"); | ||||||
|  |             } | ||||||
|  |             System.out.println("_______________ Muenzen _____________"); | ||||||
|  |             for(int i=0; i<muenzen.length; i++){ | ||||||
|  |                 anzMuenzen[i] = (int) (ruekGeld / muenzen[i]); | ||||||
|  |                 ruekGeld -= muenzen[i]*(float)anzMuenzen[i]; | ||||||
|  |                 if(anzMuenzen[i]>0) System.out.println(anzMuenzen[i] + " x " + (int)(muenzen[i]*100) + " ct"); | ||||||
|  |             } | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user