-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbusTicketSystem.java
More file actions
70 lines (50 loc) · 1.7 KB
/
busTicketSystem.java
File metadata and controls
70 lines (50 loc) · 1.7 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
import java.util.Scanner;
class D {
private int dd = 0;
private int mm = 0;
private int yyyy = 0;
public void setDate(int dd, int mm, int yyyy) {
this.dd = dd;
this.mm = mm;
this.yyyy = yyyy;
}
public String getDate() {
String currentDate = dd + "/" + mm + "/" + yyyy;
return currentDate;
}
}
class ticketSystem {
String beginningLocation;
String endingLocation;
D dateOfTravel;
public ticketSystem() {
this.beginningLocation = "Pune";
this.endingLocation = "Mumbai";
this.dateOfTravel = new D();
this.dateOfTravel.setDate(1, 1, 2024);
}
public void checkForAvailableTickets(String beginningLocation, String endingLocation, D dateOfTravel) {
int flagTicketsAvailable = 0;
if (flagTicketsAvailable == 0) {
System.out.println("Sorry, no tickets are available");
}
}
public void bookNewTickets() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter your Beginning Location:");
this.beginningLocation = sc.nextLine();
System.out.println("Enter your Destination:");
this.endingLocation = sc.nextLine();
System.out.println("Enter Date of Travel [int dd-mm-yyyy format]:");
int dd = sc.nextInt();
int mm = sc.nextInt();
int yyyy = sc.nextInt();
sc.close();
this.dateOfTravel.setDate(dd, mm, yyyy);
this.checkForAvailableTickets(this.beginningLocation, this.endingLocation, this.dateOfTravel);
}
}
public class busTicketSystem {
public static void main(String[] args) {
}
}