-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
100 lines (80 loc) · 2.72 KB
/
Test.java
File metadata and controls
100 lines (80 loc) · 2.72 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
public class Test {
public static void main(String[] args) {
Book book = new Book(
"The Little Prince",
112,
"Pegasus",
"Antoine de Saint-Exupéry",
new String[]{"Little Prince"});
Novel novel = new Novel(
"The Eye of Minds",
304,
"Pegasus",
"James Dashner",
new String[]{"Michael", "Sarah", "Brian"}, "Science Fiction");
Magazine magazine = new Magazine(
"National Geographic",
123,
"NatGeo",
2024,
"November 2024");
TechnicalJournal journal = new TechnicalJournal(
"IEEE Transactions on Neural Networks",
150,
"IEEE",
"Artificial Intelligence and Machine Learning",
11.23,
32,
4,
2024);
Textbook textbook = new Textbook(
"Modern Physics for Scientists and Engineers",
850,
"Pearson Education",
"Physics",
"Undergraduate");
ComicBook comic = new ComicBook(
"Spider-Man",
50,
"Marvel",
"Stan Lee",
new String[]{"Peter Parker", "Mary Jane"},
"Steve Ditko");
EBook ebook = new EBook(
"Clean Code",
464,
"Prentice Hall",
"Robert C. Martin",
new String[]{},
"PDF");
// Display details and descriptions
book.displayDetails();
book.describeMaterial();
System.out.println();
novel.displayDetails();
novel.describeMaterial();
System.out.println();
magazine.displayDetails();
magazine.describeMaterial();
System.out.println();
journal.displayDetails();
journal.describeMaterial();
System.out.println();
textbook.displayDetails();
textbook.describeMaterial();
System.out.println();
comic.displayDetails();
comic.describeMaterial();
System.out.println();
ebook.displayDetails();
ebook.describeMaterial();
// Save to file
FileHandler.saveToFile(book, "books.txt");
FileHandler.saveToFile(novel, "books.txt");
FileHandler.saveToFile(magazine, "books.txt");
FileHandler.saveToFile(journal, "books.txt");
FileHandler.saveToFile(textbook, "books.txt");
FileHandler.saveToFile(comic, "books.txt");
FileHandler.saveToFile(ebook, "books.txt");
}
}