1
1
// Define your Book class here:
2
- class Book {
3
- constructor ( title , author , copyrightDate , ISBN , numPages , numCheckedOut , discardBook ) {
4
- this . title = title ;
5
- this . author = author ;
6
- this . copyrightDate = copyrightDate ;
7
- this . ISBN = ISBN ;
8
- this . numPages = numPages ;
9
- this . numCheckedOut = numCheckedOut ;
10
- this . discardBook = discardBook ;
11
- }
12
- }
13
2
14
3
15
4
// Define your Manual and Novel classes here:
16
- class Manual extends Book {
17
- constructor ( ) {
18
- super ( ) ;
19
- if ( this . copyrightDate < ( 2024 - 5 ) ) {
20
- this . discardBook = "should be discarded"
21
- return `"${ this . title } " is over 5 years old, ${ this . discardBook } !` ;
22
- }
23
- }
24
- }
25
-
26
-
27
- class Novel extends Book {
28
- constructor ( ) {
29
- super ( ) ;
30
- if ( this . numCheckedOut > 100 ) {
31
- this . discardBook = "should be Thrown OUT!" ;
32
- return `"${ this . title } " has been checked out over 100 times, ${ this . discardBook } !` ;
33
- }
34
- }
35
- }
36
5
37
6
38
7
// Declare the objects for exercises 2 and 3 here:
39
- let pridePredjudice = new Novel ( "Pride and Predjudice" , "Jane Austen" , 1813 , "1111111111111" , 432 , 32 , "No" ) ;
40
- let shuttleBuilding = new Manual ( "Top Secret Shuttle Building Manual" , "Redacted" , 2013 , "0000000000000" , 1147 , 1 , "No" ) ;
41
8
42
- console . log ( pridePredjudice ) ;
43
9
44
10
// Code exercises 4 & 5 here:
0 commit comments