You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

package jinjieti1;
import java.time.LocalDate;
import java.time.LocalDateTime;
import jichuti1.Book;
import jichuti1.Reader;
public class AdvancedTest {
public static void main(String[] args) {
// 创建主馆和分馆(聚合关系)
Library mainLib = new Library("LIB001", "市图书馆总馆");
BranchLibrary branch = new BranchLibrary("B001", "城东分馆", "城东区文化街1号");
mainLib.addBranch(branch);
// 创建借阅历史
Reader reader = new Reader("R001", "李四");
Book book = new Book("B003", "设计模式", "GOF");
BorrowHistory history = new BorrowHistory(
"H001",
reader,
book,
LocalDate.now()
);
// 创建图书馆活动
Staff staff = new Staff("S001", "王五", "活动策划");
LibraryEvent event = new LibraryEvent(
"E001",
"读书分享会",
LocalDateTime.now().plusDays(7),
mainLib
);
event.addParticipant(reader);
event.addStaff(staff);
System.out.println("创建活动:" + event.getTitle() + ",地点:" + mainLib.getName());
System.out.println("参与读者:" + reader.getName() + ",工作人员:" + staff.getName());
}
}