Skip to content

74tevans #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion classes/Book.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
// import the Media class:
const Media = require('./Media.js');

// 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(books){
let highRate = 0;
let highBook;
for (let book of books){
if (book.rating > highRate){
highRate = book.rating;
highBook = book;
}
}
return highBook;
}
}
// don't change below
module.exports = Book;
13 changes: 12 additions & 1 deletion classes/Media.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
// 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;
24 changes: 23 additions & 1 deletion classes/Movie.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
// import the Media class:
// import the Media class: (Duvall F)
const Media = require('./Media.js');

// create your Movie class:

class Movie extends Media{
constructor(title, year, genre, director, duration, rating){
super(title, year, genre);
this.director = director;
this.duration = duration;
this.rating = rating;
}
summary(){
return(`Title: ${this.title}, Director: ${this.director}, Year: ${this.year}, Genre: ${this.genre}, Rating: ${this.rating}`).toString();
}
static longestMovie([movie1,movie2]){
let highestNum = Math.max(movie1.duration,movie2.duration);
if (highestNum == movie1.duration){
return(movie1);
}
else if (highestNum == movie2.duration){
return(movie2);
}
}
}

// don't change below
module.exports = Movie;
24 changes: 22 additions & 2 deletions classes/Music.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
// import the Media class:

const Media = require('./Media.js');
// create your Music class:

class Music extends Media{
constructor(title, year, genre, artist, length){
super(title, year, genre);
this.artist = artist;
this.length = length;
}
summary(){
return `Title: ${this.title}, Artist: ${this.artist}, Year: ${this.year}, Genre: ${this.genre}, Length: ${this.length} seconds`;
}
static shortestAlbum(music){
let songLength = 999999999;
let shortSong;
for (let song of music){
if (song.length < songLength){
songLength = song.length;
shortSong = song;
}
}
return shortSong;
}
}
// don't change below
module.exports = Music;
Loading