Class AudioBook
java.lang.Object
com.university.bookstore.model.Material
com.university.bookstore.model.AudioBook
- All Implemented Interfaces:
Media,Comparable<Material>
-
Nested Class Summary
Nested classes/interfaces inherited from class com.university.bookstore.model.Material
Material.MaterialTypeNested classes/interfaces inherited from interface com.university.bookstore.model.Media
Media.MediaQuality -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcalculateListeningSessions(int minutesPerDay) Calculates listening sessions based on daily listening time.intgetAdjustedDuration(double speed) Gets playback speed adjusted duration.Gets the author.Abstract method to get the creator/author/artist of the material.doubleHook method for discount rate.Abstract method to get a formatted display string.intGets the duration of the media in minutes.doubleGets the file size in megabytes.Gets the file format of the media.getIsbn()Gets the ISBN.Gets the language.Gets the narrator.Gets the quality setting for the media.booleanChecks if the media requires an internet connection.booleanChecks if unabridged.toString()Methods inherited from class com.university.bookstore.model.Material
compareTo, equals, getDiscountedPrice, getId, getPrice, getTitle, getType, getYear, hashCodeMethods inherited from interface com.university.bookstore.model.Media
estimateDownloadTime, getPlaybackInfo
-
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 identifiertitle- book titleauthor- original authornarrator- voice narratorprice- price in dollarsyear- publication yearduration- duration in minutesformat- audio format (MP3, M4B, etc.)fileSize- size in megabytesquality- audio quality levellanguage- narration languageunabridged- true if unabridged version
-
-
Method Details
-
getCreator
Description copied from class:MaterialAbstract method to get the creator/author/artist of the material. Implementation varies by material type.- Specified by:
getCreatorin classMaterial- Returns:
- the creator's name
-
getDisplayInfo
Description copied from class:MaterialAbstract method to get a formatted display string. Each material type should provide its own formatting.- Specified by:
getDisplayInfoin classMaterial- Returns:
- formatted display string
-
getDuration
public int getDuration()Description copied from interface:MediaGets the duration of the media in minutes.- Specified by:
getDurationin interfaceMedia- Returns:
- duration in minutes
-
getFormat
-
getFileSize
public double getFileSize()Description copied from interface:MediaGets the file size in megabytes.- Specified by:
getFileSizein interfaceMedia- Returns:
- size in MB
-
isStreamingOnly
public boolean isStreamingOnly()Description copied from interface:MediaChecks if the media requires an internet connection.- Specified by:
isStreamingOnlyin interfaceMedia- Returns:
- true if streaming required, false if downloadable
-
getQuality
Description copied from interface:MediaGets the quality setting for the media.- Specified by:
getQualityin interfaceMedia- Returns:
- quality descriptor
-
getDiscountRate
public double getDiscountRate()Description copied from class:MaterialHook method for discount rate. Default is no discount. Subclasses can override to provide type-specific discounts.- Overrides:
getDiscountRatein classMaterial- 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
Gets the ISBN. @return the ISBN -
getAuthor
Gets the author. @return the author -
getNarrator
Gets the narrator. @return the narrator -
getLanguage
Gets the language. @return the language -
isUnabridged
public boolean isUnabridged()Checks if unabridged. @return true if unabridged -
toString
-