Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can i make this Method-  isFree () - returns true if the book is free


public class AudioBook extends Book {

	private String readerName;
	LocalTime recordDuration;
	private int priceForDownload; 
	
	
	public AudioBook(String bookName, String bookAuthor, LiteratureGenre bookGenre, Locale bookLanguage, LocalDate bookDateOfMade,String readerName, LocalTime recordDuration, int priceForDownload) {
		super(bookName,bookAuthor,bookGenre, bookLanguage,bookDateOfMade);
		this.readerName = readerName;
		this.recordDuration = recordDuration;
		this.priceForDownload = priceForDownload;
	}


What I have tried:

I really don't know which to include
Posted
Updated 11-Dec-21 3:58am
Comments
Richard MacCutchan 11-Dec-21 9:32am    
Just test if the price is zero or non-zero.

1 solution

Try:
Java
public boolean isFree() {
    return priceForDownLoad == 0;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900