Computer Science  ·  Level 6
Fundamentals Of Programming
Chapter 6: Object Oriented Programming
📚 4 Topics
⚑ What you will be able to do

By the end of this chapter, you will be able to:

  • apply object-oriented programming principles confidently in your projects.
  • create and use classes correctly to organize your code.
  • implement objects based on classes to represent real-world things clearly.
  • apply inheritance to build meaningful relationships between classes.
  • develop programs that reuse and extend code effectively through inheritance.

Mastering these skills will help you write clean, efficient programs that solve real-world problems just like professional developers do!

Chapter Practical Activities

Practical 1: Define and Implement Classes and Objects for a Library System

Computer Science · Level 6
Fundamentals Of Programming
PRACTICAL ASSESSMENT
TIME: 4 HOURS
⬇ PDFCandidate Instructions (Candidate Tool)

Type: Individual

INSTRUCTIONS TO CANDIDATE:
1.  You are required to perform the following task:
i.  Define a class 'Book' with attributes and methods, then create and manipulate objects to display book details and availability status.
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Functional computer installed with Java IDE (NetBeans/Eclipse/IntelliJ)Class attributes: bookID, title, author, isAvailable
Plain paperMethods: displayDetails(), borrowBook(), returnBook()
Pen
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Functional computer installed with Java IDE (NetBeans/Eclipse/IntelliJ)1 Pc per Candidate
2Plain paper1 Pc per Candidate
3Pen1 Pc per Candidate
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Define Class and Attributes
Launched the Java IDE
(Award 2 marks or 0)
2
Declared class named 'Book'
(Award 2 marks or 0)
2
Declared attributes: bookID, title, author, isAvailable
(Award 1 mark for each attribute declared correctly)
4
Sub-Total8
TASK 2: Implement Methods
Declared method displayDetails() that prints all book attributes
(Award 3 marks or 0)
3
Declared method borrowBook() that sets isAvailable to false
(Award 3 marks or 0)
3
Declared method returnBook() that sets isAvailable to true
(Award 3 marks or 0)
3
Sub-Total9
TASK 3: Create and Manipulate Objects
Created at least two Book objects with initial values
(Award 3 marks or 0)
3
Called displayDetails() method on each object
(Award 3 marks or 0)
3
Called borrowBook() on one object and verified isAvailable status
(Award 3 marks or 0)
3
Called returnBook() on same object and verified isAvailable status
(Award 3 marks or 0)
3
Sub-Total12
PRODUCT CHECKLIST
Class Book correctly defined with all attributes and methods
(Award 6 marks or 0)
6
Objects created and methods function as expected with correct output
(Award 5 marks or 0)
5
Sub-Total11
GRAND TOTAL40
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)

Practical 2: Implement Encapsulation Using Access Modifiers in a Java Class

Computer Science · Level 6
Fundamentals Of Programming
PRACTICAL ASSESSMENT
TIME: 4 HOURS
⬇ PDFCandidate Instructions (Candidate Tool)

Type: Individual

INSTRUCTIONS TO CANDIDATE:
1.  You are required to perform the following task:
i.  Write a Java class named 'Student' with private attributes and public getter and setter methods for name (String), age (int), and grade (char).
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Computer with Java IDE (Eclipse/NetBeans/IntelliJ)Plain A4 Paper
Pen
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Computer with Java IDE (Eclipse/NetBeans/IntelliJ)1 Pc per Candidate
2Plain A4 Paper2 Pcs per Candidate
3Pen1 Pc per Candidate
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Class Declaration and Attributes
Launched Java IDE and created a new Java project
(Award 2 marks or zero)
2
Declared class named 'Student'
(Award 2 marks or zero)
2
Declared private attributes: name (String), age (int), grade (char)
(Award 2 marks for each correctly declared attribute)
6
Sub-Total10
TASK 2: Getter and Setter Methods Implementation
Declared public getter methods for all private attributes
(Award 2 marks for each correctly implemented getter method)
6
Declared public setter methods for all private attributes
(Award 2 marks for each correctly implemented setter method)
6
Setter methods include basic validation: age >= 0, grade is a valid char
(Award full 4 marks if validation is implemented correctly, else zero)
4
Sub-Total16
TASK 3: Testing and Display
Created a main method to instantiate the Student class object
(Award 2 marks or zero)
2
Used setter methods to assign values to attributes
(Award 1 mark for each attribute assigned correctly)
3
Used getter methods to display the attribute values
(Award 1 mark for each attribute displayed correctly)
3
Sub-Total8
PRODUCT CHECKLIST
Class 'Student' compiles without errors and encapsulation is correctly implemented
(Award 5 marks if code compiles and encapsulation is demonstrated)
5
Getter and setter methods correctly restrict direct access to private attributes
(Award 5 marks for proper use of access modifiers and method functionality)
5
Output shows correct attribute values retrieved via getter methods
(Award 5 marks if output matches assigned values)
5
Sub-Total15
GRAND TOTAL49
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)
🔒

Free: practical guides, quick cards, workplace scenarios and more.

Create a free account
🔒Implement a subclass demonstrating inheritance in JavaPractical 3
🔒Implement polymorphism using method overriding in JavaPractical 4
🔒Implement a Student Class with Constructors and DestructorsPractical 5
🔒Implement Interface and Abstract Class for Vehicle Management SystemPractical 6
🔒Demonstrate Association and Aggregation in Java ClassesPractical 7
🔒Implement Composition in Classes for a Library Management SystemPractical 8
🔒Implement a Java class using static variables and methods to track instance countPractical 9
🔒Implement Exception Handling in a Java Object-Oriented ProgramPractical 10
Am I competent?

At the start of this chapter we promised you would be able to:

  • apply object-oriented programming principles confidently in your projects.
  • create and use classes correctly to organize your code.
  • implement objects based on classes to represent real-world things clearly.
  • apply inheritance to build meaningful relationships between classes.
  • develop programs that reuse and extend code effectively through inheritance.

Tick each one you can genuinely do.

So, are you there yet?

You're competent when you can confidently do 50% or more of what this chapter promised.

Sign in to record how you're doing.