import java.util.ArrayList;
import java.util.List;
class User {
private int id;
private String name;
private String email;
private String address;
public User(int id, String name, String email, String address) {
this.id = id;
this.name = name;
this.email = email;
this.address = address;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public String getAddress() {
return address;
}
}
public class UserRecordGenerator {
public static List<User> generateUserRecords(int numberOfUsers) {
List<User> users = new ArrayList<>();
for (int i = 0; i < numberOfUsers; i++) {
// Generate some dummy data
int userId = i + 1;
String userName = "User" + userId;
String userEmail = "user" + userId + "@example.com";
String userAddress = "Address " + userId;
User user = new User(userId, userName, userEmail, userAddress);
users.add(user);
}
return users;
}
public static void main(String[] args) {
int numUsers = 10; // Adjust the number of users as needed
List<User> userRecords = generateUserRecords(numUsers);
// Print the generated user records (for verification)
for (User user : userRecords) {
System.out.println("ID: " + user.getId() + ", Name: " + user.getName() + ", Email: " + user.getEmail() + ", Address: " + user.getAddress());
}
}
}
Add your comment