Untitled
unknown
plain_text
a year ago
1.4 kB
11
Indexable
import java.time.LocalDate;
public class Booking {
private static int nextId = 5000; //remove setbookingid because we do not want to change the value
private static int generateNextId() { //return current id and increment
return nextId++;
}
private int bookingId;
private LocalDate bookingDate;
private Classroom classroom;
private Lecturer lecturer;
public Booking(LocalDate bookingDate, Classroom classroom, Lecturer lecturer) { //booking date, classroom, lecturer
this.bookingId = generateNextId(); //generates booking Id
this.bookingDate = bookingDate;
this.classroom = classroom;
this.lecturer = lecturer;
}
public int getBookingId() {
return bookingId;
}
public LocalDate getBookingDate() {
return bookingDate;
}
public Classroom getClassroom() {
return classroom;
}
public Lecturer getLecturer() {
return lecturer;
}
public void setBookingDate(LocalDate bookingDate) {
this.bookingDate = bookingDate;
}
public void setClassroom(Classroom classroom) {
this.classroom = classroom;
}
public void setLecturer(Lecturer lecturer) {
this.lecturer = lecturer;
}
public String toString() {
return " Booking ID: " + bookingId + " Booking Date: " + bookingDate + " Classroom: " + classroom + " Lecturer: " + lecturer;
}
}
Editor is loading...
Leave a Comment