0% found this document useful (0 votes)
2 views

oop lab-36209

The document outlines a lab assignment for a Software Engineering course focused on Object Oriented Programming. It includes tasks to create Java classes demonstrating inheritance and method overriding, such as an 'Animal' class with a 'Bird' subclass, a 'Food' class hierarchy, and a geometric shape class structure. Each task requires specific methods and constructors to showcase object-oriented principles.

Uploaded by

bm6775893
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)
2 views

oop lab-36209

The document outlines a lab assignment for a Software Engineering course focused on Object Oriented Programming. It includes tasks to create Java classes demonstrating inheritance and method overriding, such as an 'Animal' class with a 'Bird' subclass, a 'Food' class hierarchy, and a geometric shape class structure. Each task requires specific methods and constructors to showcase object-oriented principles.

Uploaded by

bm6775893
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/ 7

DEPARTMENT OF SOFTWARE ENGINEERING

Object Oriented Programming Lab

Lab#07

Submitted By
Bilal Ahmed
RIT-9245005

Submitted To
Miss Sobia Yousaf

CLASS: BSIT II-Morning


NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering

Task 01:
Create a Java class named "animal" that has three data members i.e
name, age, noise. It includes public methods for getting name and
speak() to display the data members values. Create a child class named
Bird having to attributes height and color.it also includes two member
methods print_bird() and speak() that displays the information of animal
and bird.

Input Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering

Output Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering

Task 02:
Create three classes Food, Fruit and Apple in such a way that class Apple
extends Fruit class and Fruit class extends class Food. Create a
constructor in each class containing only a statement to print current
class name. Call all the three constructors using constructor chaining.

Input Screen:

Output Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering

Task 03:
Create a class named SimpleGeometricObject and two subclasses
RectangleFromSimpleGeometricObject and CirclefromGeometricObject.
Add a new method drawShape( ) in SimpleGeometricObject (i.e.,
superclass) Class and over-rides this method into subclass i.e.,
RectangleFromSimpleGeometricObject and CirclefromGeometricObject
to draw a specific shape according to subclass specification.

Input Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering

Output Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering

You might also like