sign_up_user implemented and new logic for csv data

sign_in_up_out
Daniel Zdravkovic 2024-06-10 15:17:36 +02:00
parent f5e74fbbe5
commit 96e7dad23f
1 changed files with 21 additions and 3 deletions

View File

@ -65,9 +65,6 @@ public class System {
while((path = bufferedReader.readLine()) != null){
fileString = path.split(";");
fileString = (String[]) Arrays.stream(fileString)
.map(string -> string.substring(0, string.length()-1))
.toArray();
encoding(fileString[1]);
all_users.add(new User(fileString[0], fileString[1], fileString[2],
Integer.parseInt(fileString[3]), fileString[4],
@ -106,6 +103,27 @@ public class System {
hometown, zip, car_name,
car_l_100km, car_avg_kmh, bike_avg_kmh);
ArrayList<String> content = new ArrayList<>();
for(User user : mem){
content.add(user.getUsername() + ";" + user.getPassword() + ";" + user.getHometown()
+ ";" + user.getZip() + ";" + user.getCar_name()
+ ";" + user.getCar_l_100km() + ";" + user.getCar_avg_kmh()
+ ";" + user.getBike_avg_kmh());
}
File file = new File("/user_data.csv");
try {
FileWriter fileWriter = new FileWriter(file, false);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
for (String line : content) {
bufferedWriter.write(line);
bufferedWriter.newLine();
}
bufferedWriter.close();
} catch (IOException e) {}
return true;
}
return false;