all_user_toString method and write_to_file method implemented to help with sign_up_user
parent
735c1f38ea
commit
bc8c19bc66
|
@ -79,9 +79,25 @@ public class System {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
all_users.add(current_user);
|
||||
|
||||
return all_users;
|
||||
}
|
||||
|
||||
public ArrayList<String> all_user_toString(){
|
||||
|
||||
ArrayList<String> result = new ArrayList<>();
|
||||
ArrayList<User> all_user = get_all_user();
|
||||
|
||||
for(User user : all_user){
|
||||
result.add(getDetails()[0] + ";" + getDetails()[1] + ";" + getDetails()[2] + ";" + getDetails()[3]
|
||||
+ ";" + getDetails()[4] + ";" + getDetails()[5] + ";" + getDetails()[6] + ";" + getDetails()[7]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean sign_in_user(String username, String password) {
|
||||
ArrayList<User> mem = get_all_user();
|
||||
|
||||
|
@ -129,6 +145,16 @@ public class System {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void write_to_file(ArrayList<String> lines, String file) {
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
|
||||
for (int i = 0; i < lines.size() - 1; i++) {
|
||||
writer.write(lines.get(i));
|
||||
writer.newLine();
|
||||
}
|
||||
writer.write(lines.getLast());
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
|
||||
/*public boolean sign_up_user(String username, String password, String hometown, String zipS,
|
||||
String car_name, String car_l_100kmS, String car_avg_kmhS, String bike_avg_kmhS) throws IOException {
|
||||
int zip = Integer.parseInt(zipS);
|
||||
|
|
Loading…
Reference in New Issue