0% found this document useful (0 votes)
53 views3 pages

CASE STUDY2 - DFP30243 - OOP - Sesi1 - 2022 - 2023

This document provides instructions for an assessment on object oriented programming. Students are asked to develop a program to illustrate inheritance and polymorphism using different animal classes that each have their own implementation of a sound method. The program should include classes for Animal, Dog, Cat, and Duck, with each extending the Animal class. It should demonstrate polymorphism by calling the sound method on objects of each type. Students will be evaluated on variables, logic, output, style and meeting the specifications outlined.

Uploaded by

khairiyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views3 pages

CASE STUDY2 - DFP30243 - OOP - Sesi1 - 2022 - 2023

This document provides instructions for an assessment on object oriented programming. Students are asked to develop a program to illustrate inheritance and polymorphism using different animal classes that each have their own implementation of a sound method. The program should include classes for Animal, Dog, Cat, and Duck, with each extending the Animal class. It should demonstrate polymorphism by calling the sound method on objects of each type. Students will be evaluated on variables, logic, output, style and meeting the specifications outlined.

Uploaded by

khairiyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SESSION SESSION 1 2022/2023

INFORMATION
TECHNOLOGY & DFP30243 OBJECT ORIENTED
COURSE
COMMUNICATION PROGRAMMING
DEPARTMENT
ASSESSMENT METHOD CASE STUDY 2
TOPIC
4.0 Inheritance and Polymorphism

CHECKED BY: APPROVED BY:


PREPARED BY:
CLO (Course Coordinator/ Head (Head of Department/
(Course Lecturer)
of Programme) Head of Programme)

CLO2: Display skills to


use graphical/visual data
to visualize the concept
(TUNKU KHAIRIYAH BINTI TUNKU (NOOR HALAWATI BINTI CHE MEH) (NOOR HALAWATI BINTI CHE MEH)
of (P4, PLO6) NORIZAN)

CLO2
NAME : __________________________________________
REGISTRATION NO. : __________________________________________ TOTAL /25

INSTRUCTION

As we know every animal has a different sound. For example, Dog, Cat and Duck will have own
sound method implementation as shown below. Develop a program to illustrate inheritance and
polymorphism concept in the diagram below. [CLO2, P4] (25 marks)

Expected Output:
Example Codes:

class Animal {
public void sound() {
System.out.println("The animal makes a sound");
}
}

class Dog extends Animal {


public void sound() {
System.out.println("Dog says: Woof Woof");
}
}

class Cat extends Animal {


public void sound() {
System.out.println("Cat says: Meow Meow");
}
}

class Duck extends Animal {


public void sound() {
System.out.println("Duck says: Quack Quack");
}
}

public class PolymorphismExercise {


public static void main(String arg[]) {
//Creating objects
Animal animal = new Animal(); //Animal object
Animal dog = new Dog(); //Dog object
Animal cat = new Cat(); //Cat object
Animal duck = new Duck(); // Duck object

animal.sound();
dog.sound();
cat.sound();
duck.sound();
}
}
Assessment Rubric:

Required 5 4 3 2 1 Marks
Element
1) variable and Highly detailed Good detailed Detailed but Few Detailed. No details.
object declaration moderately 3-4 variables Only 1-2
detailed variables
2) Programming Very good Good program Moderate Program Program
Logic: program compiles, no program compiles, compiles and
i. selection compiles, no logic error and compiles, no minimal logic display
statement logic error and exceed logic error and error and meet incorrect error,
implementation exceed specification meet most of most of minimal logic
specification specification specification error and
failed to meet
specification
3) Programming Very good Good program Moderate Program Program
logic: program compiles, no program compiles, compiles and
i. Repetition compiles, no logic error and compiles, no minimal logic display
statement logic error and exceed logic error and error and meet incorrect error,
implementation exceed specification meet most of most of minimal logic
specification specification specification error and
failed to meet
specification
4) Programming Very good Good program Moderate Program Program
Logic: program compiles, no program compiles, compiles and
a. Display related compiles, no logic error and compiles, no minimal logic display
information based logic error and exceed logic error and error and meet incorrect error,
on input values exceed specification meet most of most of minimal logic
specification specification specification error and
failed to meet
specification
5) Programming 100% follow 80% follow the 50% follow the 30% follow the 10% follow the
Style and the writing writing format writing format writing format writing format
documentation: format and and and and and
documentation documentation documentation documentation documentation
-naming convention
-indentation

You might also like