-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.java
More file actions
102 lines (90 loc) · 2.57 KB
/
User.java
File metadata and controls
102 lines (90 loc) · 2.57 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package User;
import Posting.Group;
import Posting.Page;
import Posting.Post;
import java.sql.Time;
import java.util.ArrayList;
class creditcard{
String number;
int credit;
}
public class User {
public creditcard card;
public String id;
public String gender;
public String email;
public ArrayList<User> friends;
public ArrayList<User> users;
public ArrayList<Post> posts;
public String username;
public String password;
public String country;
public String birthDate;
public ArrayList<User> friendRequests;
public boolean prem;
public boolean sendFriendRequest(User user){
if(this.searchUser(user.username )){
System.out.println("User Exist You Can Send Your Request");
return true;
}
System.out.println("User Not Exist You Can't Send Your Request");
return false;
}
public void getFriendRequests(User user) {
if(sendFriendRequest(this)){
boolean accept = true;
System.out.println("You Can Accept The Request!");
System.out.println("You Can Delete The Request!");
if(accept){
ArrayList<Post> posts1 = this.posts;
System.out.println("he/she can see");
for(int i = 0 ; i < posts1.size() ; i++){
System.out.println(posts1.get(i).numOfShares);
System.out.println(posts1.get(i).numOfLikes);
System.out.println(posts1.get(i).time);
}
}
else{
System.out.println("Request Deleted!");
}
}
else{
System.out.println("You Havn't any friend Request!");
}
}
public boolean searchUser(String usernameOrEmail) {
User u = new User();
for(int i = 0 ; i < u.users.size() ; i++){
if(usernameOrEmail.equals(u.email) || usernameOrEmail.equals(u.username));
return true;
}
return false;
}
public Group searchGroup(String groupName) {
return null;
}
public Page searchPage(String pageName) {
return null;
}
public void likePage(Page page) {
}
public void joinGroup(Group group) {
}
public ArrayList<Post> searchForHash(String hash) {
return null;
}
public boolean checkcredit(String creditcardnum){
if(creditcardnum.length() < 10 ){
System.out.println("invalid credit card");
return false;
}
else{
if(creditcardnum == card.number){
return true;
}
else{
return false;
}
}
}
}