-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTicket.java
More file actions
74 lines (58 loc) · 2.29 KB
/
Ticket.java
File metadata and controls
74 lines (58 loc) · 2.29 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
import java.nio.charset.Charset;
import java.util.Random;
import java.lang.Math.*;
import java.util.*;
// import javax.mail.*;
// import javax.mail.internet.*;
// import javax.activation.*;
public class Ticket {
private String code;
private String seat;
Ticket(String s){
//new String(array, Charset.forName("UTF-8"));
seat = s;
createCode();
}
public void createCode(){
String letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
StringBuilder s = new StringBuilder(5);
for (int i =0; i<5;i++){
int letter = (int)(letters.length()* Math.random());
s.append(letters.charAt(letter));
}
code = s.toString();
}
public String getCode(){
return code;
}
public String getSeat(){
return seat;
}
// public static void emailTicket(String t, String movie, String details){
// String host="smtp.gmail.com";
// final String user="ensf480project@gmail.com";//change accordingly
// final String password="ensf480!";//change accordingly
// String to="muteeba.jamal02@gmail.com";//change accordingly
// //Get the session object
// Properties props = new Properties();
// props.put("mail.smtp.host",host);
// props.put("mail.smtp.auth", "true");
// Session session = Session.getDefaultInstance(props,
// new javax.mail.Authenticator() {
// protected PasswordAuthentication getPasswordAuthentication() {
// return new PasswordAuthentication(user,password);
// }
// });
// //compose the message
// try{
// MimeMessage message = new MimeMessage(session);
// message.setFrom(new InternetAddress(user));
// message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
// message.setSubject("Booking confirmation");
// message.setText("Hello, this is booking confirmation for: "+movie+". Info: "+ details+". Thank you!");
// // Send message
// Transport.send(message);
// // System.out.println("message sent successfully....");
// }catch (MessagingException mex) {mex.printStackTrace();}
// }
}