Skip to content

IT-forward/js-cla-build-a-library

Repository files navigation

How to run and test?

As previous tasks it uses yarn and jest testing framework so the process is the same:

  1. git clone the repo.
  2. Create new branch with your name and checkout.
  3. Run yarn.
  4. To run tests: run yarn test or yarn watch depending on your preference.

Build a Library

Congratulations, you’ve passed the grueling rigmarole of librarian school and have become head librarian at your local Books-‘N-Stuff.

Just as you sit down, eager to utilize all those skills you learned in “Lib 203 - Shushing: How to Maintain Order While Spitting”, you realize you’re still using index cards to handle everything.

But no matter, you know some JavaScript, so let’s get to work modernizing your new digs.

Books-‘N-Stuff carries three different types of media: books, CDs, and movies. In this project you will create a parent class named Media with three subclasses: Book, Movie, and CD. These three subclasses have the following properties and methods:

Book

Properties:

  • author: string
  • title: string
  • pages: number
  • isCheckedOut: boolean, initially false
  • ratings: array, initially empty

Getters: all properties have a getter

Methods:

  • .getAverageRating()
  • .toggleCheckOutStatus()
  • .addRating()

Movie

Properties:

  • director: string
  • title: string
  • runTime: number
  • isCheckedOut: boolean, initially false
  • ratings: array, initially empty

Getters: all properties have a getter

Methods:

  • .getAverageRating()
  • .toggleCheckOutStatus()
  • .addRating()

CD

Properties:

  • artist: string
  • title: string
  • isCheckedOut: boolean, initially false
  • ratings: array, initially empty
  • songs: array of strings

Getters: all properties have a getter

Methods:

  • .getAverageRating()
  • .toggleCheckOutStatus()
  • .addRating()

After you implemented each of them in resources.js, inside index.js:

  • create an object at least from one of the class type
  • console.log each getter's value
  • test each method's behavior

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published