Skip to content

Commit 0da958c

Browse files
Quinton KornegayQuinton Kornegay
Quinton Kornegay
authored and
Quinton Kornegay
committed
I think im done?
1 parent 227afc4 commit 0da958c

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

classes/exercises/ClassExercises.js

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,52 @@
11
// Define your Book class here:
2-
3-
2+
class Book {
3+
constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
4+
this.title = title;
5+
this.author = author;
6+
this.copyright = copyright;
7+
this.isbn = isbn;
8+
this.pages = pages;
9+
this.timesCheckedOut = timesCheckedOut;
10+
this.discarded = discarded;
11+
}
12+
13+
checkout(uses=1) {
14+
this.timesCheckedOut += uses;
15+
}
16+
}
17+
418
// Define your Manual and Novel classes here:
5-
19+
class Manual extends Book {
20+
constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
21+
super(title, author, copyright, isbn, pages, timesCheckedOut, discarded);
22+
}
23+
24+
dispose(currentYear){
25+
if (currentYear-this.copyright > 5) {
26+
this.discarded = 'Yes';
27+
}
28+
}
29+
}
30+
31+
class Novel extends Book {
32+
constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
33+
super(title, author, copyright, isbn, pages, timesCheckedOut, discarded);
34+
}
35+
36+
dispose(){
37+
if (this.timesCheckedOut > 100) {
38+
this.discarded = 'Yes';
39+
}
40+
}
41+
}
642

743
// Declare the objects for exercises 2 and 3 here:
44+
let prideAndPrejudice = new Novel ('Pride and Prejudice', 'Jane Austen', 1813, 1111111111111, 432, 32, 'No');
45+
let shuttleManual = new Manual ('Top Secret Shuttle Building Manual', 'Redacted', 2013, 0o000000000, 1147, 1, 'No');
46+
47+
48+
// Code exercises 4 & 5 here:
849

950

10-
// Code exercises 4 & 5 here:
51+
prideAndPrejudice.checkout(5);
52+
prideAndPrejudice.dispose();

0 commit comments

Comments
 (0)