remake for new project - finished CSV reader and format for USER class

This commit is contained in:
k2320390 committed 2025-02-24 12:36:30 +00:00
1 parent 5b6028e3b9
commit e6db06dd8b
3 files changed
+31 -9

No files matched your search

+4 -2
View File
@@ -4,6 +4,7 @@
*/
package userprofilebuilder;
import userprofilebuilder.model.User;
import userprofilebuilder.view.MainViewer;
import java.io.*;
@@ -26,8 +27,9 @@ public class App {
try (BufferedReader reader = new BufferedReader(new FileReader("userprofile.csv"))) {
while (reader.ready()) {
String line = reader.readLine();
String[] splitter = line.split(",");
String[] split = line.split(",");
User hi = new User(split[0], split[1], split[2], split[3]);
// add user to SINGLETON user group...
}
} catch (Exception ex) {
throw new RuntimeException(ex);
@@ -4,9 +4,6 @@
*/
package userprofilebuilder.model;
import java.io.BufferedReader;
import java.io.FileReader;
/**
*
* @author
@@ -14,17 +11,33 @@ import java.io.FileReader;
*/
public class User {
private String profile;
private String Profile;
private String Title;
private String Username;
private String Email;
public User(String profile, String title, String username, String email)
{
this.Profile = profile;
this.Title = title;
this.Username = username;
this.Email = email;
}
public String getProfile() {
return profile;
return Profile;
}
public void setProfile(String profile) {
this.profile = profile;
this.Profile = profile;
}
public String getTitle() {
@@ -14,10 +14,17 @@ import java.util.*;
*/
public class UserGroup {
public ArrayList<User> users;
public UserGroup()
{
ArrayList<User> users = new ArrayList<>();
users = new ArrayList<>();
}
public void addUser(User user)
{
users.add(user);
}
}