Class AudioBook

java.lang.Object
com.university.bookstore.model.Material
com.university.bookstore.model.AudioBook
All Implemented Interfaces:
Media, Comparable<Material>

public class AudioBook extends Material implements Media
Represents an audio book that implements both Material and Media interfaces. Demonstrates multiple inheritance through interfaces.
Since:
2024-09-15
Version:
2.0
Author:
Navid Mohaghegh
  • Constructor Details

    • AudioBook

      public AudioBook(String isbn, String title, String author, String narrator, double price, int year, int duration, String format, double fileSize, Media.MediaQuality quality, String language, boolean unabridged)
      Creates a new AudioBook with full specifications.
      Parameters:
      isbn - ISBN identifier
      title - book title
      author - original author
      narrator - voice narrator
      price - price in dollars
      year - publication year
      duration - duration in minutes
      format - audio format (MP3, M4B, etc.)
      fileSize - size in megabytes
      quality - audio quality level
      language - narration language
      unabridged - true if unabridged version
  • Method Details

    • getCreator

      public String getCreator()
      Description copied from class: Material
      Abstract method to get the creator/author/artist of the material. Implementation varies by material type.
      Specified by:
      getCreator in class Material
      Returns:
      the creator's name
    • getDisplayInfo

      public String getDisplayInfo()
      Description copied from class: Material
      Abstract method to get a formatted display string. Each material type should provide its own formatting.
      Specified by:
      getDisplayInfo in class Material
      Returns:
      formatted display string
    • getDuration

      public int getDuration()
      Description copied from interface: Media
      Gets the duration of the media in minutes.
      Specified by:
      getDuration in interface Media
      Returns:
      duration in minutes
    • getFormat

      public String getFormat()
      Description copied from interface: Media
      Gets the file format of the media.
      Specified by:
      getFormat in interface Media
      Returns:
      format string (e.g., "MP3", "MP4", "WAV")
    • getFileSize

      public double getFileSize()
      Description copied from interface: Media
      Gets the file size in megabytes.
      Specified by:
      getFileSize in interface Media
      Returns:
      size in MB
    • isStreamingOnly

      public boolean isStreamingOnly()
      Description copied from interface: Media
      Checks if the media requires an internet connection.
      Specified by:
      isStreamingOnly in interface Media
      Returns:
      true if streaming required, false if downloadable
    • getQuality

      public Media.MediaQuality getQuality()
      Description copied from interface: Media
      Gets the quality setting for the media.
      Specified by:
      getQuality in interface Media
      Returns:
      quality descriptor
    • getDiscountRate

      public double getDiscountRate()
      Description copied from class: Material
      Hook method for discount rate. Default is no discount. Subclasses can override to provide type-specific discounts.
      Overrides:
      getDiscountRate in class Material
      Returns:
      discount rate between 0.0 and 1.0
    • calculateListeningSessions

      public int calculateListeningSessions(int minutesPerDay)
      Calculates listening sessions based on daily listening time.
      Parameters:
      minutesPerDay - daily listening time
      Returns:
      number of days to complete
    • getAdjustedDuration

      public int getAdjustedDuration(double speed)
      Gets playback speed adjusted duration.
      Parameters:
      speed - playback speed (1.0 = normal, 1.5 = 1.5x, etc.)
      Returns:
      adjusted duration in minutes
    • getIsbn

      public String getIsbn()
      Gets the ISBN. @return the ISBN
    • getAuthor

      public String getAuthor()
      Gets the author. @return the author
    • getNarrator

      public String getNarrator()
      Gets the narrator. @return the narrator
    • getLanguage

      public String getLanguage()
      Gets the language. @return the language
    • isUnabridged

      public boolean isUnabridged()
      Checks if unabridged. @return true if unabridged
    • toString

      public String toString()
      Overrides:
      toString in class Material