This commit is contained in:
Luca Conte 2023-03-15 17:19:53 +01:00
parent 2adfa78616
commit 7c073359f3
8 changed files with 72 additions and 0 deletions

BIN
u02.zip Normal file

Binary file not shown.

10
u02/.classpath Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
u02/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/bin/

17
u02/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>u02</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

4
u02/data.csv Normal file
View File

@ -0,0 +1,4 @@
Name;Geburtsjahr;Lieblingsfarbe;Lieblingszahl
Heinz;1973;blau;33,3
Anne;1972;rot;9
Hans;1969;gelb;1000,01
1 Name Geburtsjahr Lieblingsfarbe Lieblingszahl
2 Heinz 1973 blau 33,3
3 Anne 1972 rot 9
4 Hans 1969 gelb 1000,01

24
u02/src/Main.java Normal file
View File

@ -0,0 +1,24 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Formatter;
import java.util.Locale;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
Scanner f = new Scanner(new File("data.csv"));
Formatter formatter = new Formatter(System.out, new Locale("de", "DE"));
f.nextLine();
while (f.hasNextLine()) {
String l = f.nextLine();
String[] values = l.split(";");
formatter.format(
"%-14s ist gebohren in %4d und liebt %-10s und %07.2f%n",
values[0],
Integer.parseInt(values[1]),
values[2],
Double.parseDouble(values[3].replace(',','.'))
);
}
}
}