logo

Crowdly

3.2      6.       Given the code above, implement the abstract method...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

3.2

    

6.      Given the code above, implement the abstract methods in the Novel class as follows:

          a)            calculateRentalFee()

·         Base fee is $3.50

·         If the book is less than 5 years old, add $2.00

·         If the book is between 5 and 10 years old, add $1.00

·         Add $0.50 for every 100 pages (round up to the next 100)

·         If the genre is "Bestseller" or "New Release", add a 20% premium to the total fee

·         Return the final fee rounded to two decimal places

 getBookInfo()

·         Format book details as "Novel: [Title] by [Author] (Year), Genre: [Genre], [Pages] pages"

c)      Given the following main method create test objects and demonstrate your implementation

 

·         Create at least two Novel objects with different properties

·         Print their information using getBookInfo()

·         Display the rental fees

(25 marks)

More questions like this

Want instant access to all verified answers on learning.richfield.ac.za?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome