Created
January 10, 2020 11:13
-
-
Save rishisidhu/7c07b82a4b3df1662d26ff00d464f1ed to your computer and use it in GitHub Desktop.
Sub class of Book.java.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*Sub Class : EBook | |
*Author : Rishi Sidhu | |
*Organization : AI Graduate | |
**/ | |
public class EBook extends Book | |
{ | |
public String downloadSite; | |
public int sizeMB; | |
public EBook(String au, float cp, float sp, String tl, int pg, String ds, int sz){ | |
super(au,cp,sp,tl,pg); | |
downloadSite = ds; | |
sizeMB = sz; | |
} | |
//Get the per page size | |
public float pageSize() | |
{ | |
return ((float)sizeMB/(float)pages); | |
} | |
//Print book title | |
public void printTitle() | |
{ | |
System.out.print("The title of this book is: "+ title); | |
} | |
//Compute tax on net profit per book @ 30% + A fixed $2 ebook tax | |
public float getTax() | |
{ | |
return (0.3f*this.netProfit() + 2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment