logo

Crowdly

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

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

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)

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на learning.richfield.ac.za?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome