-
Notifications
You must be signed in to change notification settings - Fork 0
/
Booking.java
27 lines (24 loc) · 861 Bytes
/
Booking.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
public class Booking {
private static int prevId = 10000;
private int id;
private Trip trip;
private int bookedSeats;
private String vendorName = "";
public Booking(Trip trip, int seats, String vendorName) {
this.trip = trip;
bookedSeats = seats;
this.vendorName = vendorName;
id = prevId + 1;
prevId = id;
}
public Trip getTrip() {
return trip;
}
public String toString() { // booking successful toString method
return "Booking #" + id + "\n" +
"Trip: " + vendorName + "#" + trip.getID() + "\n" +
trip.getStartingLocation() + "\t to \t" + trip.getDestination() + "\n" +
trip.getDateOfDeparture() + "\t\t" + trip.getDateOfArrival() + "\n" +
"Booked seats: " + bookedSeats + "\n";
}
}