-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSocialNetworkApp.java
74 lines (57 loc) · 1.78 KB
/
SocialNetworkApp.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.MyNetwork;
import java.util.*;
public class SocialNetworkApp {
private HashMap<String, User> users;
private PriorityQueue<Post> postQueue;
public SocialNetworkApp() {
// Initialize the HashMap to store users
this.users = new HashMap<>();
// Initialize the PriorityQueue to store posts
this.postQueue = new PriorityQueue<>(Comparator.comparingInt(Post::getLikes).reversed());
// Load user data from file
loadUserData();
}
private void loadUserData() {
// Load user data from file
}
private void saveUserData() {
// Save user data to file
}
public void run() {
// Main menu and user interaction
}
private void login(Scanner scanner) {
// Login logic
}
private void createAccount(Scanner scanner) {
// Account creation logic
}
private void homeScreen(Scanner scanner, User user) {
// Home screen options
}
private void viewUserPosts(User user) {
// View user's posts
}
private void viewMostLikedPost() {
// View most liked post
}
private void viewFollowedUsersPosts(User user, Scanner scanner) {
// View posts from followed users
}
private void addNewPost(User user, Scanner scanner) {
// Add new post
}
private void viewFollowers(User user) {
// View user's followers
}
private void viewFollowedUsers(User user) {
// View users followed by user
}
private void followUser(User user, Scanner scanner) {
// Follow a user
}
public static void main(String[] args) {
SocialNetworkApp app = new SocialNetworkApp();
app.run();
}
}