logo

Crowdly

Browser

Add to Chrome

PROGRAMMING 731(2025S1PRO731D)

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:

  • Creates an ArrayList<String> to store names of five programming languages.
  • Adds the following languages to the list: "Java", "Python", "C++", "JavaScript", "Ruby".
  • Replaces "C++" with "C#" in the list.
  • Displays all the elements of the updated list
  • Displays the total number of elements in the list.

(15 marks)

View this question

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)

View this question

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)

View this question

3.1 Write a Java program that:

  1. Creates a 2D array of integers with 3 rows and 4 columns.
  2. Initializes the array with the following values, where each row represents a student’s marks and each column represents a specific module:

  1. Calculates and prints the total marks for each row (for each student).
  2. Displays the result in the following format:

(25 marks)

View this question

1.4 Describe the concept of encapsulation in Object-Oriented Programming (5 marks)

View this question

1.3 Define method overriding and explain its relationship with polymorphism (5 marks)

View this question

1.2 Differentiate between Arrays and ArrayLists (5 marks)

View this question

1.1 Define Exception Handling and explain why it is necessary (5 marks)

View this question

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