der fehler auf linie 23 macht keinen unterschied, das chaos muss früher beginnen
wie trenne ich integer und double aus der gleichen line einfach und effektiv?
package de.codegym.task.task19.task1919;
import java.io.*;
import java.util.*;
/*
Gehälter berechnen
*/
public class Solution {
public static void main(String[] args) throws IOException {
try(FileReader file = new FileReader("c:\\asdf");
BufferedReader reader = new BufferedReader(file);){ //why does this not work? they also dont close? why?
TreeMap<String, Double> tree = new TreeMap<>();
while(reader.ready()){
String string = reader.readLine(); //read the whole line of the file(1 line)
String name = string.replaceAll("[0-9]", ""); //replace all numbers to get the name
String num = string.replaceAll("\\D+", ""); //replace all letters to get the number
double number = Double.parseDouble(name);
tree.put(name, number);
for(Map.Entry e : tree.entrySet()){ //print the ONE LINE thats read so far and print the list unsorted(i dont know how yet)
String s = (String)e.getKey();
double d = (double)e.getValue();
System.out.println(s + " " + d);
}
}
}catch(FileNotFoundException e){}
}
}