Witajcie,
Chciałbym stworzyć interakcje między obiektami. Jeśli dodam obiekt zamówienie o2, chciałbym żeby zmieniło to książkę x2 na niedostępną. Help.
public class TestObject {
public static void main(String args[]) {
Book x1 = new Book("Hodowla owiec", 1, true);
Book x2 = new Book("Hodowla burakow", 2, true);
Orders o1 = new Orders(1, 1);
}
}
class Book {
String title;
int id;
boolean available;
public Book(String title, int id, boolean available){
this.title = title;
this.id = id;
this.available = available;
}
String getTitle(){
return title;
}
int getId(){
return id;
}
boolean isAvailable(){
return available;
}
}
class Orders {
int orderid;
int bookid;
public Orders(int orderid, int bookid){
this.orderid = orderid;
this.bookid = bookid;
}
}