From 2b38596dcfe521ff18aa9b3805d3deffb8d46e88 Mon Sep 17 00:00:00 2001 From: apatni123 Date: Tue, 1 Oct 2024 12:49:39 +0100 Subject: [PATCH] updated --- classes/Book.js | 26 ++++++++++++++++++++++++-- classes/Media.js | 16 ++++++++++++++++ package-lock.json | 3 ++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/classes/Book.js b/classes/Book.js index ee69d54..0c36370 100644 --- a/classes/Book.js +++ b/classes/Book.js @@ -1,6 +1,28 @@ // 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(arr){ + let rating = 0 + let index =0 + for (let i=0;i