Looking for PROGRAMMING 731(2025S1PRO731D) test answers and solutions? Browse our comprehensive collection of verified answers for PROGRAMMING 731(2025S1PRO731D) at learning.richfield.ac.za.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
2.2 Write a Java program that:
(15 marks)
2.1 Study the code below. Identify all lines that contain errors. For each error, provide the line number and provide corrected code.
(15 marks)
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)
3.1 Write a Java program that:
(25 marks)
1.4 Describe the concept of encapsulation in Object-Oriented Programming (5 marks)
1.3 Define method overriding and explain its relationship with polymorphism (5 marks)
1.2 Differentiate between Arrays and ArrayLists (5 marks)
1.1 Define Exception Handling and explain why it is necessary (5 marks)