From 5deae510b8f87215e02c2b1dc5dcea6f068d9dcf Mon Sep 17 00:00:00 2001 From: Rubin A Tollinchi <118833320+Rtollinchi@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:39:59 -0400 Subject: [PATCH 1/2] Update Media.js --- classes/Media.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/classes/Media.js b/classes/Media.js index d4d718b..eb7c363 100644 --- a/classes/Media.js +++ b/classes/Media.js @@ -1,4 +1,19 @@ // create your Media class: +// create your Media class: +class Media { + static totalMediaCount = 0; + constructor(title, year, genre) { + this.title = title; + this.year = year; + this.genre = genre; + Media.totalMediaCount++; + } + summary() { + return `Title: ${this.title}, Year: ${this.year}, Genre: ${this.genre}`; + } +} +// uncomment below to export it: +module.exports = Media; // uncomment below to export it: module.exports = Media; From af1b0158297f5935b85dfb572da3a33f332bdd54 Mon Sep 17 00:00:00 2001 From: Rubin A Tollinchi <118833320+Rtollinchi@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:40:36 -0400 Subject: [PATCH 2/2] Update Book.js --- classes/Book.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/classes/Book.js b/classes/Book.js index ee69d54..4ff8cb2 100644 --- a/classes/Book.js +++ b/classes/Book.js @@ -1,6 +1,26 @@ // import the Media class: - +const Media = require("./Media"); // create your Book class: - +class Book extends Media { + constructor(title, year, genre, author, numpages, rating) { + super(title, year, genre); + this.author = author; + this.numpages = numpages; + this.rating = rating; + } + summary() { + return `Title: ${this.title}, Author: ${this.author}, Year: ${this.year}, Page Count: ${this.numpages}, Genre: ${this.genre}, Rating: ${this.rating}`; + } + static highestRating(Book) { + let highestRatedBook = Book[0]; + for (let i = 0; i < highestRatedBook.rating; i++) { + if (Book[i].rating > highestRatedBook.rating) { + highestRatedBook = Book[i]; + } + } + return highestRatedBook; + } +} // don't change below module.exports = Book; +